Bugs item #1592533, was opened at 2006-11-08 10:46
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1592533&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Documentation
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Martin Thorsen Ranang (ranang)
Assigned to: Nobody/Anonymous (nobody)
Summary: Unfortunate naming of variable in heapq example

Initial Comment:
In the current "Python Library Reference"
documentation, in section "5.4 heapq -- Heap queue
algorithm", an example goes:

>>> sorted = []
>>> while heap:
...     sorted.append(heappop(heap))
...
>>> print sorted
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

However, 'sorted' is the name of a built-in function. 
Of course, the example does not constitute an error,
but it might be misleading to new users of the
language.  Consider:

>>> sorted = []
>>> should_be_sorted = sorted([4, 3, 1, 2])
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: 'list' object is not callable
>>> 

Hence, I suggest to rename the variable in the example
to 'ordered'.

Yours,



Martin Thorsen Ranang

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1592533&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to