Why is there no __iter__() for lists strings and tuples?
Aahz
aahz at pythoncraft.com
Fri Dec 20 15:32:37 EST 2002
In article <YLKM9.128712$Qr.3283548 at news3.calgary.shaw.ca>,
Parzival Herzog <parz at shaw.SpamBucket.ca> wrote:
>
>In real life:
>
>ActivePython 2.2.2 Build 224 (ActiveState Corp.) based on
>Python 2.2.2 (#37, Nov 26 2002, 10:24:37) [MSC 32 bit (Intel)] on win32
>Type "help", "copyright", "credits" or "license" for more information.
>
>>>> x = 'abcdef'
>>>> x.__iter__()
>Traceback (most recent call last):
> File "<stdin>", line 1, in ?
>AttributeError: 'str' object has no attribute '__iter__'
Python 2.2.2 (#1, Oct 17 2002, 12:22:01)
[GCC egcs-2.91.66 19990314 (egcs-1.1.2 release)] on netbsd1
Type "help", "copyright", "credits" or "license" for more information.
>>> iter("abcdef")
<iterator object at 0x816ebc0>
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"To me vi is Zen. To use vi is to practice zen. Every command is a
koan. Profound to the user, unintelligible to the uninitiated. You
discover truth everytime you use it." --reddy at lion.austin.ibm.com
More information about the Python-list
mailing list