[Tutor] range as a not-quite-iterator

Jim Mooney cybervigilante at gmail.com
Sun Aug 4 03:14:31 CEST 2013


using py3.3 on win7

I'm reading the Lutz book, and he clearly calls range an iterator in
the context of Python 3.0, yet when I try

x = range(1,10)
next(x)
I get: builtins.TypeError: 'range' object is not an iterator
And x itself is returned as: range(1, 10)

What am I missing here? Is it an iterator or not?

-- 
Jim
The Curiosity Rover has been on Mars a year. It feels like it landed,
at most, a few months ago. Where is the time going?


More information about the Tutor mailing list