Unless I'm misconstruing something the problem is that reversed returns two
different object types depending on if it's a list or a tuple

>>> l = [1,2,3,4]
>>> i = iter(l)
>>> ri = reversed(l)
>>> l
[1, 2, 3, 4]
>>> ri
<listreverseiterator object at 0x00D5C8F0>
>>> i
<listiterator object at 0x00D5C3F0>
>>> t = (1,2,3,4)
>>> it = iter(t)
>>> rit = reversed(t)
>>> it
<tupleiterator object at 0x00D5C030>
>>> rit
<reversed object at 0x00D5CC90>
>>>

reversing a tuple (or a string) returns a "reversed object"
reversing a list returns a "listreverseiterator"

definitely an inconsistency
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to