[Python-bugs-list] [ python-Bugs-480337 ] Tut: Dict used before dicts explained

noreply@sourceforge.net noreply@sourceforge.net
Sat, 10 Nov 2001 03:21:00 -0800


Bugs item #480337, was opened at 2001-11-10 03:21
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=480337&group_id=5470

Category: Documentation
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Andrew Bennetts (spiv)
Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: Tut: Dict used before dicts explained

Initial Comment:
This was pointed out to me by someone on #python, who
was rather confused by this...

In Section 5.1.4 of the Tutorial it has an example of a
list comprehension:
"""
>>> [{x: x**2} for x in vec]
[{2: 4}, {4: 16}, {6: 36}]
"""

But the "{x: x**2}" is confusing, because dictionaries
haven't been explained yet (that's Section 5.4).

This example either needs to be removed or modified. 
It is a good example of the sort of expression you can
use in a list comprehension, so I'd recommend adding an
comment referring the reader to Section 5.4, rather
than removing it.

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

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