Empty list as default parameter

Bengt Richter bokr at oz.net
Sun Nov 23 12:14:34 EST 2003


On 23 Nov 2003 16:33:37 GMT, bokr at oz.net (Bengt Richter) wrote:
[...]
>to code explicitly in any case. E.g., is it obvious that getattr(os, 'RD_ONLY')
>should be done at call time or optimized away to def time in os.open('foo.txt', os.RD_ONLY) ?
I meant during os.open('foo.txt') assuming def open(...) had a default mode expressed as an attribute
expression. But that's bad as a real example. So please assume a customized file opener that uses
os.open and has a default mode parameter os.RD_ONLY ;-)

>I don't think you can optimize it away without telling the compiler one way or another,
>or changing the dynamic nature of the language.
>
>In any case it would be a semantic change, and I'd hate to have the job of finding breakage ;-)
>
I'll leave that as is ;-)

Regards,
Bengt Richter




More information about the Python-list mailing list