In article <[email protected]>, BartC <[email protected]> wrote: >"Steven D'Aprano" <[email protected]> wrote in message >news:[email protected]... >> >> xrange = range >> >> There, that wasn't hard, was it? > >I think I just learned more about Python than from months of reading this >group. > >So 'range' is just a class like any other. And that a class is something you >can blithely copy from one variable to another. And whenever you see 'range' >anywhere, you can't always be certain that someone hasn't done: > >range = 42 > >at some point. That explains a lot about the difficulties of implementing >Python efficiently. (And the xrange=range trick works well thanks.)
Actually, range() is a function. But the same point applies, squared -- you really can never know what kind of object is hiding behind a name in the general case. -- Aahz ([email protected]) <*> http://www.pythoncraft.com/ "...if I were on life-support, I'd rather have it run by a Gameboy than a Windows box." --Cliff Wells -- http://mail.python.org/mailman/listinfo/python-list
