[ python-Bugs-1194209 ] Error in section 4.2 of Python Tutorial

SourceForge.net noreply at sourceforge.net
Wed May 4 15:34:30 CEST 2005


Bugs item #1194209, was opened at 2005-05-02 23:02
Message generated for change (Comment added) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1194209&group_id=5470

Category: Documentation
Group: Not a Bug
>Status: Closed
>Resolution: Invalid
Priority: 3
Submitted By: Andrina Kelly (andrina)
Assigned to: Nobody/Anonymous (nobody)
Summary: Error in section 4.2 of Python Tutorial

Initial Comment:
The example in section 4.2 of the on-line tutorial should read as 
follows:

>>> # Measure some strings:
... a = ['cat', 'window', 'defenestrate']
>>> for x in a:
...     print x, len(a)
... 
cat 3
window 6
defenestrate 12

currently the print line has len(x)



----------------------------------------------------------------------

>Comment By: Raymond Hettinger (rhettinger)
Date: 2005-05-04 08:34

Message:
Logged In: YES 
user_id=80475

Sorry, this is correct as is.

I'm not sure why you would think that len(a) is appropriate.
 That would give the length of the list which is always
equal to three.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1194209&group_id=5470


More information about the Python-bugs-list mailing list