In <[EMAIL PROTECTED]>, James T. Dennis wrote:

> Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
>> In <[EMAIL PROTECTED]>, James T. Dennis wrote:
> 
>> You can change it by simply assigning to the name:
> 
>> In [15]: tempfile.template = 'spam'
> 
>> In [16]: tempfile.template
>> Out[16]: 'spam'
> 
>       I know you can change it.  But changing it in your namespace
>       doesn't change the results returned by the functions called
>       from the module.

I'm not changing it in my namespace but in the namespace of the `tempfile`
module.

>               I don't quite understand how this name/variable in
>               my namespace (__main__) is able to change the value
>               while the functions in the module still hold the old
>               value.

Default arguments are evaluated *once* when the ``def`` is executed and
not at every function call.

Ciao,
        Marc 'BlackJack' Rintsch
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to