2 ms·
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 result
by dfinninger 4y ago
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 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();.