> It means no multi-line lambdas so you end up with these unreadable list comprehensions
You can have multi-line lambdas, just use parens:
(lambda: look.ma.im
.on_two_lines)
And, yeah, if it's complex enough that it should have control flow, you just write a nested function.
And your example is more clearly expressed as a plain loop:
new_list = []
for item in items:
for sub_item in item.sub_items:
if item.is_the_best:
new_list.append(item)
I don't like the comprehension syntax. The correct comprehension is:
[item
for item in items
for sub_item in item.sub_items
if item.is_the_best]
Hopefully that makes plain what they were going for, but in practice, list comprehensions are often a contradiction in terms.
> Not to mention these random global functions everywhere.
We ought to be able to have it both ways, it should be possible to lift a closure and treat the variables it closes over as arguments, but I wind up doing that manually just so I can test them directly.
> Lines copied into the console care about indentation which is definitely not a fun DX.
I think the issue with breaking copy and paste is the real valid complaint against indentation-sensitive languages. The tooling just isn't there, and this continues to be the case after 20 years.