[Tutor] replacing range with xrange
bgailer at alum.rpi.edu
Mon Jan 28 17:11:33 CET 2008
Kent Johnson wrote:
> bob gailer wrote:
>> I disagree based on PEP 3100 (http://www.python.org/dev/peps/pep-3100/)
>> Built-in Namespace:
>> - Make built-ins return an iterator where appropriate (e.g. range(),
>> zip(), map(), filter(), etc.)
>> To be removed:
>> - xrange(): use range() instead
> Right, that's a good clarification.
> xrange() is being renamed to range(), so there will be no xrange() and
> range() will return an iterator rather than a list.
> Hmm, does that mean that the arguments to range() will be restricted to
> long integers?
Well the same PEP says:
- Remove distinction between int and long types
919-636-4239 Chapel Hill, NC
More information about the Tutor