Built-in functions and keyword arguments

Tim Chase python.list at tim.thechases.com
Mon Oct 29 10:44:05 EDT 2007


>> <ot>
>> While we're at it, you should avoid using builtin's names for 
>> identifiers - here, using 'object' as the arg name shadows the builtin 
>> 'object' class).
>> </ot>
> 
> I think you are being a little bit unfair here: help(len) says:
> 
> len(...)
>     len(object) -> integer
>     
>     Return the number of items of a sequence or mapping.
> 
> which implies that the argument to len has the name 'object' (although in 
> fact it doesn't have a name). 

And to confound matters even further for the uninitiated,

http://docs.python.org/lib/built-in-funcs.html#l2h-45

says that it's "len(s)" instead (but "len(s=[])" doesn't work either)

-tkc







More information about the Python-list mailing list