2 ms·
Always disliked the design of iterators in Python - you use 'def' but it's not a function, you call it like a function but it preserved its state - there should
by jstx1 3y ago
Always disliked the design of iterators in Python - you use 'def' but it's not a function, you call it like a function but it preserved its state - there should be a less confusing way to express these semantics than yield.
- redman25 3y agoSeems fine to me :shrug: as long as you know that using yield changes the ‘def’ to return a generator. It’s a bit of syntactic sugar but simple enough to follow.