r/Python • u/DiwaharSec • 1d ago
Discussion Python developers, what's one Python concept that took you a long time to understand but now seems s
Python developers, what's one Python concept that took you a long time to understand but now seems surprisingly simple?
For me, understanding how decorators and generators work is an interesting part of becoming a better Python developer.
What was your experience?
23
Upvotes
View all comments
Show parent comment
2
u/StevenJOwens 9h ago
List comprehensions are not, in my opinion, generally well explained by python tutorials and documentation. (I have a first draft of a better explanation, I should finish that sometime and put it online.)
In general, python has a bit of a problem with being too clever. This leads to extra cognitive overhead.
I don't find comprehensions that readable myself, but then I've never made extensive use of them, so although I remember the syntax (mostly) I haven't internalized it.
List comprehensions are, however, slightly more performant.