News for hackers. Stuff that matters.
Re:Python is not a great programming language by nnq on Saturday October 12, 2019 @05:25PM (#21236444)
> Should performing `thing[7]` put 1-6 in memory and turn the object into a generator-list hybrid

You're right here. Probably can't work like that since generators are too general, you can't expect them to be rewindable or to not have side effects... prob you'd need a more specialized concept like a "lazy list" that would be a subtype of generator with some extra restrictions that would make it possible to implement the "hybrid" structure as an implementation detail without changing semantics.

Anyway... it would be too much work and probably would turn into a footgun.

There are no comments on this comment yet.