Re: Is this correct behavior for default parameters?

2008-07-16 Thread Fredrik Lundh
Bruce Pearson wrote: The first call to test has the file_list empty but on the second call to test the file_list is no longer empty but contains the values appended in the first call. Is this correct behavior? I'm using python 2.5 yes: http://docs.python.org/ref/function

Is this correct behavior for default parameters?

2008-07-15 Thread Bruce Pearson
The first call to test has the file_list empty but on the second call to test the file_list is no longer empty but contains the values appended in the first call. Is this correct behavior? I'm using python 2.5 def test(param_1, file_list = []): if len(file_list) == 0:

Re: Correct behavior?

2007-04-27 Thread Mitja Trampus
[EMAIL PROTECTED] wrote: > On Apr 26, 8:34 pm, asker <[EMAIL PROTECTED]> wrote: >> But:>>> print "%15.2f" % a+b >> >> Traceback (most recent call last): >> File "", line 1, in >> TypeError: cannot concatenate 'str' and 'float' objects >> >> Is this correct for Python to issue this error? > > Th

Re: Correct behavior?

2007-04-26 Thread DanBishop04
On Apr 26, 8:34 pm, asker <[EMAIL PROTECTED]> wrote: > Hello: > I have next Python 2.5.1 instructions: > > >>> a=12.34 > >>> b=11.23 > >>> print a+b > > 23.57 > > >>> print "%15.2f" % (a+b) > > 23.57 > > But:>>> print "%15.2f" % a+b > > Traceback (most recent call last): > File "", line

Correct behavior?

2007-04-26 Thread asker
Hello: I have next Python 2.5.1 instructions: >>> a=12.34 >>> b=11.23 >>> print a+b 23.57 >>> print "%15.2f" % (a+b) 23.57 But: >>> print "%15.2f" % a+b Traceback (most recent call last): File "", line 1, in TypeError: cannot concatenate 'str' and 'float' objects Is this correct fo