[Python-3000] Equality of range objects

Nick Coghlan ncoghlan at gmail.com
Wed Apr 9 09:03:16 CEST 2008


Anand Balachandran Pillai wrote:
> Still this seems like a bad thing to break backward compatibility with.
> However I cannot really provide a use-case apart from what Benjamin
> has said -> Teaching. It is not a common use-case to equate ranges
> in code and that is bad coding anyway.
> 
> Hopefully, this will be well documented at 3.0 release. Currently
> that "whats new" page does not mention anything about the range
> type and how it breaks backward compatibility.
> 
> The NEWS page for 3.0 a4 does say this however.
> 
> "range() now returns an iterator rather than a list.  Floats are not allowed.
>   xrange() is no longer defined."

That's actually wrong. xrange objects (and Py3k's range objects) aren't 
iterators, they're only iterables (they don't provide a next/__next__ 
method).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-3000 mailing list