[docs] 4.7.2. Keyword Arguments - Small Typo: 'sort()' -> 'sorted()'

Joe Mirizio joemirizio at yahoo.com
Sat Apr 30 18:33:39 CEST 2011


>From 4.7.2. Keyword Arguments:
"
def cheeseshop(kind, *arguments, **keywords): print "-- Do you have any", kind, "?" print "-- I'm sorry, we're all out of", kind for arg in arguments: print arg print "-" * 40 keys = sorted(keywords.keys()) for kw in keys: print kw, ":", keywords[kw]

...

Note that the sort()method of the list of keyword argument names is
called before printing the contents of the keywordsdictionary; if this is
not done, the order in which the arguments are printed is undefined.
"

The note at the bottom says sort(), but the method used in the above code section is sorted()

Since sorted() is like a built-in function rather than a method of list, the sentence might need to be 

reworded to something like:

'Note that the built-in sorted() function is called on the list of keyword 

argument names before printing the contents of the keyword dictionary...'

It should also link to http://docs.python.org/library/functions.html#sorted
Hope this helps!

    

      Joe Mirizio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20110430/1d34a267/attachment-0001.html>


More information about the docs mailing list