Built-in functions and keyword arguments

Duncan Booth duncan.booth at invalid.invalid
Tue Oct 30 18:43:48 CET 2007

"J. Clifford Dyer" <jcd at sdf.lonestar.org> wrote:

>> How do you interpret:
>> >>> help(__import__)
>> Help on built-in function __import__ in module __builtin__:
>> __import__(...)
>>     __import__(name, globals={}, locals={}, fromlist=[], level=-1) ->
>> module
>> ...
>> >>> help(int)
>> Help on class int in module __builtin__:
>> class int(object)
>>  |  int(x[, base]) -> integer
>> ...
>> Can you find any case (other than a single parameter identified as 
>> 'object') where you can interpret the help string as telling you the
>> types of the parameters?
> 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')

More information about the Python-list mailing list