where dos the default agument live in? local name spaces or gloabal namespaces or else?

Greg Krohn ("X", "@") "gkrohnXvolucris.8m.com".replace
Fri Aug 16 05:46:53 CEST 2002


"lion" <dance_code at hotmail.com> wrote in message
news:e895ad50.0208151917.61e959c2 at posting.google.com...
> I just feel name spaces are ambiguous in a sense.If I defined a
> function in the Python shell:
> >>>def f(a, L=[]):
>        L.append(a)
>        return L
> and I invoked it with the default agrument value: f(1).Now I don't
> know where the default agument L lives in? No matter I use dir() or
> dir(f),there is no L listed in the result.

f.func_defaults

BTW, there's lots of cool stuff in f.func_*:

func_closure
func_code
func_defaults
func_dict
func_doc
func_globals
func_name





More information about the Python-list mailing list