Dumb python questions
Alex Martelli
aleaxit at yahoo.com
Thu Aug 16 16:36:46 EDT 2001
"Paul Rubin" <phr-n2001 at nightsong.com> wrote in message
news:7xzo90pw17.fsf at ruckus.brouhaha.com...
...
> Xrange is apparently a primitive type, which sounds like a big kludge.
"primitive"? I'd call it a middling-kludge.
> Maybe in Python 2.2 they can make it into an iterator. That would be
> the right way to deal with this problem.
Yep, but iterators weren't around when xrange was introduced. The
"do the right thing" (MIT approach, big-design-up-front approach --
see Gabriel's article as mentioned in my last post) would of course
have been to stop the world until iterators were designed -- the "worse
is better" (NJ approach, just-in-time-design approach, Python's
approach) is incremental and adaptive. xrange started out VERY
ambitious -- used to do all sort of things to mimic the behavior of
the list it 'represented'. Turns out it's basically only used for the
purpose of iterating -- so it was simplified by removing most of
its complications, and there may be iterators to take its place now.
Alex
More information about the Python-list
mailing list