tworld icon indicating copy to clipboard operation
tworld copied to clipboard

Simple iterators: range(), enumerate()

Open erkyrath opened this issue 9 years ago • 1 comments

And maybe map(), filter(), zip()...?

The hazards of supporting iterators in the Twython environment will need much meditation. But they gotta be safer than the "naive" implementation of range() as returning a (perhaps gigantic) list object.

erkyrath avatar May 06 '15 02:05 erkyrath

Python nitpickers remind me that a range object is not a generator; it's a sequence object with extra brainpower for the "in" operator (contains).

http://stackoverflow.com/questions/30081275/why-is-1000000000000000-in-range1000000000000001-so-fast

erkyrath avatar May 08 '15 22:05 erkyrath