Bugs item #1592533, was opened at 2006-11-08 09:46 Message generated for change (Comment added) made by gbrandl 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: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: Martin Thorsen Ranang (ranang) >Assigned to: Georg Brandl (gbrandl) 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 ---------------------------------------------------------------------- >Comment By: Georg Brandl (gbrandl) Date: 2006-11-08 10:04 Message: Logged In: YES user_id=849994 Thanks! Fixed in rev. 52668, 52669 (2.5). ---------------------------------------------------------------------- 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