In article <o4oho.85508$za5.26...@newsfe16.ams2>, BartC <ba...@freeuk.com> wrote: >"Steven D'Aprano" <steve-remove-t...@cybersource.com.au> wrote in message >news:4c85adfe$0$11115$c3e8...@news.astraweb.com... >> >> 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 (a...@pythoncraft.com) <*> 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