News for hackers. Stuff that matters.
Re:Introducing PyScript (summary of PyCon keynote) by dfinninger on Thursday June 23, 2022 @10:40AM (#31849747)
Yeah that Python would not pass my code review. Rule of thumb is don’t nest list comprehensions, and if you have to try to keep it to two. Checkpoint the results info a variable. You aren’t supposed to chain like that in Python.

From https://docs.python.org/3/tutorial/datastructures.html#id2

> You might have noticed that methods like insert, remove or sort that only modify the list have no return value printed – they return the default None. [1] This is a design principle for all mutable data structures in Python.

> Footnotes > [1] Other languages may return the mutated object, which allows method chaining, such as d->insert("a")->remove("b")->sort();.

There are no comments on this comment yet.