question od default args

Bengt Richter bokr at
Sat Jun 29 12:38:24 EDT 2002

On Sat, 29 Jun 2002 12:32:02 GMT, "Fredrik Lundh" <fredrik at> wrote:

>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...
Perhaps accessing "implementation details" should depend on importing
a module that enables access one way or another? E.g.,

    import __version_2_2_implementation_details__

could serve to signal that Guido et al didn't really
mean to define a portable abstraction for production use?

Bengt Richter

More information about the Python-list mailing list