question od default args

Fredrik Lundh fredrik at
Sat Jun 29 14:32:02 CEST 2002

Mark Jackson wrote:

> More quickly:
>     def myfunc(arg=[]):
>         if arg is myfunc.func_defaults[0]:
>             print "no argument"
>         else:
>             ...

while the func_ attributes are documented, a quick peek in
the standard library should tell you that it's best to treat them
as an implementation detail.

the less such stuff you depend on in your production code,
the more portable it gets...


More information about the Python-list mailing list