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: document default values for sort parameters
Type: Stage:
Components: Documentation Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, isandler
Priority: normal Keywords:

Created on 2007-07-16 20:40 by isandler, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg32519 - (view) Author: Ilya Sandler (isandler) Date: 2007-07-16 20:40
sort() and sorted() accept several optional parameters.

Should default values for those optional parameters be documented? (E.g. I think both for sort and key None is the default value)

Explicitly documented defaults are needed, e.g. if you need to write a wrapper.

 def  sortWrapper( data, userKey=None)
        #do something
        data.sort(key=userKey)

(if you don't know the default values, you have to write something ugly like:

 def  sortWrapper( data, userKey=None)
        #do something
        if userKey is None:
           data.sort()
        else:
           data.sort(userKey) 


Or am I missing something?
msg59385 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-01-06 15:35
Thanks, fixed in r59773.
History
Date User Action Args
2022-04-11 14:56:25adminsetgithub: 45208
2008-01-06 15:35:06georg.brandlsetstatus: open -> closed
resolution: fixed
messages: + msg59385
nosy: + georg.brandl
2007-07-16 20:40:17isandlercreate