This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Error in section 4.2 of Python Tutorial
Type: Stage:
Components: Documentation Versions:
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: andrina, rhettinger
Priority: low Keywords:

Created on 2005-05-03 04:02 by andrina, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg25214 - (view) Author: Andrina Kelly (andrina) Date: 2005-05-03 04:02
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)

msg25215 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2005-05-04 13:34
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.
History
Date User Action Args
2022-04-11 14:56:11adminsetgithub: 41940
2005-05-03 04:02:15andrinacreate