erkyrath / tworld

A choice-based shared online text environment sandbox
MIT License
71 stars 13 forks source link

Simple iterators: range(), enumerate() #178

Open erkyrath opened 9 years ago

erkyrath commented 9 years ago

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 commented 9 years ago

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