Minor bug in tempfile module (possibly __doc__ error)

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Thu May 10 04:37:25 EDT 2007


In <1178779520.887569 at smirk>, James T. Dennis wrote:

> Marc 'BlackJack' Rintsch <bj_666 at gmx.net> wrote:
>> In <1178693438.689184 at smirk>, 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



More information about the Python-list mailing list