iters on ints? (reducing the need for range/xrange)

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Fri Nov 9 12:11:45 EST 2001


Fri, 9 Nov 2001 10:48:19 -0500 (EST), Steven D. Majewski <sdm7g at Virginia.EDU> pisze:

>> So under the proposed scenario, if one looks at 10 and asks "if
>> 10 were to return an iterator, what would that iterator iterate
>> over?", then it seems that range(10) would be a more *useful*
>> answer than a sequence of one element 10.
> 
> I wouldn't be against 'iter(10)' returning an iterator but having
> 10 BE an iterator is too much of a surprise.

The 'for' loop doesn't need an iterator. It needs something such that
iter(something) is an iterator. There is no need to make 10 an iterator
if we want 'for i in 10'.

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^
QRCZAK



More information about the Python-list mailing list