On 7/30/07, Steve Holden <[EMAIL PROTECTED]> wrote: > Marc 'BlackJack' Rintsch wrote: > > On Mon, 30 Jul 2007 06:32:55 -0400, Steve Holden wrote: > > > >> >>> [x for x in xrange(0, 101)] == [y for y in xrange(101)] > >> True > > > > First I thought: Why the unnecessary list comprehension but to my surprise: > > > > In [33]: xrange(42) == xrange(42) > > Out[33]: False > > > > That's strange. > > > Not so strange really. The two xrange objects are different (though I > confess I haven't looked to see how they implement comparisons), but > iterating over them produces the same result.
nitpick: list(xrange(42)) == list(xrange(42)) is slightly more concise than the list comp.. -- http://mail.python.org/mailman/listinfo/python-list