December 2018
Beginner to intermediate
796 pages
19h 54m
English
We've seen how powerful list comprehensions and generator expressions can be. And they are, don't get me wrong, but the feeling that I have when I deal with them is that their complexity grows exponentially. The more you try to do within a single comprehension or a generator expression, the harder it becomes to read, understand, and therefore maintain or change.
If you check the Zen of Python again, there are a few lines that I think are worth keeping in mind when dealing with optimized code:
>>> import this...Explicit is better than implicit.Simple is better than complex....Readability counts....If the implementation is hard to explain, it's a bad idea....
Comprehensions and generator expressions ...
Read now
Unlock full access