On Fri, Jul 15, 2011 at 11:32 AM, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote: > Inside wrote: > >> As telling in the subject,because "list" and "tuple" aren't functions,they >> are types.Is that right? > > Yes they are types. But they can still be used as functions. Does it matter?
Python is duck-typed, even in its documentation. If Python describes something as a function, it means it can be used in place of func in here: result = func(arg1, arg2, arg3) It might be something created with def (a "classic" function). It might be something created with lambda. It might be an object with a __call__ method. It might be a type. >>> class foo: def __call__(self): return lambda: print("asdf") >>> bar=foo() >>> quux=bar() >>> quux() asdf How many functions are defined here? Chris Angelico -- http://mail.python.org/mailman/listinfo/python-list