Built-in functions and keyword arguments

Armando Serrano Lombillo arserlom at gmail.com
Mon Oct 29 14:52:04 CET 2007

Why does Python give an error when I try to do this:

>>> len(object=[1,2])
Traceback (most recent call last):
  File "<pyshell#40>", line 1, in <module>
TypeError: len() takes no keyword arguments

but not when I use a "normal" function:

>>> def my_len(object):
	return len(object)

>>> my_len(object=[1,2])

More information about the Python-list mailing list