What value should be passed to make a function use the default argument value?

Steve Holden steve at holdenweb.com
Thu Oct 5 13:51:38 EDT 2006


Fredrik Lundh wrote:
> Antoon Pardon wrote:
> 
> 
>>The first module I looked in to check this, it wasn't true. In the Queue
>>Module is isn't explicitly written that maxsize is a keyword argument yet
>>Queue.Queue(maxsize=9) works just fine.
> 
> 
> it's not a matter whether it works fine in any given version of Python, 
> it's a matter of whether it's *guaranteed* to work.
> 
There are some sloppy places in the docs, though, perhaps where a 
function has started out with positionals only and keyword arguments 
have been added later, or it's just plain wrong. I remember an incident 
a month or so ago when someone had called cgi.parse with a second 
positional to retain blank values - the docs for 2.4.2 say:

    parse( fp[, keep_blank_values[, strict_parsing]])

but the function signature in the code is

    def parse(fp=None, environ=os.environ,
              keep_blank_values=0, strict_parsing=0)

IIRC he reported this as a doc bug, though probably just too late to 
make it into the initial 2.5 release. You can imagine his CGI scripts 
didn't run too well with an integer as the environment ;-)

Someone with a tendency to salt every snail (that's dotting all the i's 
and crossing all the t's for you English-speakers out there :-) could 
probably do the community a service by reviewing the documented 
signatures and report such discrepancies.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb       http://holdenweb.blogspot.com
Recent Ramblings     http://del.icio.us/steve.holden




More information about the Python-list mailing list