Built-in functions and keyword arguments

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Wed Oct 31 03:07:10 CET 2007


En Tue, 30 Oct 2007 14:43:48 -0300, Duncan Booth  
<duncan.booth at invalid.invalid> escribió:

> "J. Clifford Dyer" <jcd at sdf.lonestar.org> wrote:
>
>>> >>> help(int)
>>> Help on class int in module __builtin__:
>>>
>>> class int(object)
>>>  |  int(x[, base]) -> integer
>>> ...
>>>
>> OK, good point.  Perhaps it's not so specific as the type, but
>> certainly the use of name and x in the docstrings listed above only
>> imply something about the character of the argument, not the name of
>> the argument itself, which is what I was trying to get at.  Help
>> documentation for keyword arguments usually shows the argument being
>> used as a keyword, like the example from __import__ above.
>
> Usually, but not in the second example I gave:
>
>>>> int(base=12, x='42')
> 50

So one can conclude that, unfortunately, there is no way to tell from the  
docs alone whether a certain function will accept keyword arguments or  
not. Too bad :(

-- 
Gabriel Genellina




More information about the Python-list mailing list