Re: Default value for optional parameters unexpected behaviour?

2011-06-26 Thread Corey Richardson
Excerpts from Thomas L. Shinnick's message of Sun Jun 26 14:53:21 -0400 2011: > See reference manual section 7.6 "Function definitions" under the > discussion subtitle "Default parameter values are evaluated when the > function definition is executed. " > > http://docs.python.org/refer

Re: Default value for optional parameters unexpected behaviour?

2011-06-26 Thread Benjamin Kaplan
On Sun, Jun 26, 2011 at 11:28 AM, Marc Aymerich wrote: > Hi, > I'm trying to define a function that has an optional parameter which > should be an empty list whenever it isn't given. However, it takes as > value the same value as the last time the function was executed. What > is the reason of thi

Re: Default value for optional parameters unexpected behaviour?

2011-06-26 Thread Thomas L. Shinnick
At 01:39 PM 6/26/2011, Shashank Singh wrote: On Sun, Jun 26, 2011 at 11:58 PM, Marc Aymerich wrote: > Hi, > I'm trying to define a function that has an optional parameter which > should be an empty list whenever it isn't given. However, it takes as > value the same value as the last time the fun

Re: Default value for optional parameters unexpected behaviour?

2011-06-26 Thread Terry Reedy
On 6/26/2011 2:28 PM, Marc Aymerich wrote: Hi, I'm trying to define a function that has an optional parameter which should be an empty list whenever it isn't given. However, it takes as value the same value as the last time the function was executed. What is the reason of this behaviour? How does

Re: Default value for optional parameters unexpected behaviour?

2011-06-26 Thread Noah Hall
On Sun, Jun 26, 2011 at 7:28 PM, Marc Aymerich wrote: > Hi, > I'm trying to define a function that has an optional parameter which > should be an empty list whenever it isn't given. However, it takes as > value the same value as the last time the function was executed. What > is the reason of this

Re: Default value for optional parameters unexpected behaviour?

2011-06-26 Thread Corey Richardson
Excerpts from Marc Aymerich's message of Sun Jun 26 14:28:30 -0400 2011: > Hi, > I'm trying to define a function that has an optional parameter which > should be an empty list whenever it isn't given. However, it takes as > value the same value as the last time the function was executed. What > is

Re: Default value for optional parameters unexpected behaviour?

2011-06-26 Thread Shashank Singh
On Sun, Jun 26, 2011 at 11:58 PM, Marc Aymerich wrote: > Hi, > I'm trying to define a function that has an optional parameter which > should be an empty list whenever it isn't given. However, it takes as > value the same value as the last time the function was executed. What > is the reason of thi

Default value for optional parameters unexpected behaviour?

2011-06-26 Thread Marc Aymerich
Hi, I'm trying to define a function that has an optional parameter which should be an empty list whenever it isn't given. However, it takes as value the same value as the last time the function was executed. What is the reason of this behaviour? How does python deal with default values (i.e. when a