Discussion about this post

User's avatar
Patrick Cantwell's avatar

This was very helpful. I'm still trying to wrap my head around generators, iterators, etc., and the step-by-step walkthrough in this article clarified several things for me. Also, interestingly, when I ran sys.getsizeof(square_genexpr) in Python 3.11.4, the result was 208 bytes instead of 104. Running it on other recent Python versions, the results were 120 (v3.7.9), 112 (v3.8.10), 112 (v3.9.2), 104 (v3.10.4).

3 more comments...

No posts

Ready for more?