Re: function call - default value & collecting arguments

2008-04-03 Thread Primoz Skale
"OKB (not okblacke)" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Primoz Skale wrote: > >> OK, everything allright till so fair. But! :) Now define third >> function as: >> >> def f(*a): >>print a[0] >> >>

Re: function call - default value & collecting arguments

2008-04-03 Thread Primoz Skale
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 2 avr, 22:32, "Primoz Skale" <[EMAIL PROTECTED]> wrote: >> >> I also understand (fairly) how to collect arguments. For example, >> >> let's >> >> define another

Re: default method parameter behavior

2008-04-02 Thread Primoz Skale
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I ran into a similar situation like the following (ipython session). > Can anyone please explain why the behavior? > Thanks in advance. > > In [11]: def foo(b=[]): > : b.append(3) > : return b > : > > In [12]:

Re: function call - default value & collecting arguments

2008-04-02 Thread Primoz Skale
>> I also understand (fairly) how to collect arguments. For example, let's >> define another function: >> >> def f(*a): >>print a > > This means that f takes any number of optional positional arguments. > If nothing is passed, within f, 'a' will be an empty tuple. Note that > this is *not* the

function call - default value & collecting arguments

2008-04-02 Thread Primoz Skale
Hello! I am fairly new to Python, so I apologise if this is a 'newbie' question. First define a simple function: def f(a=0): print a >> f(1) 1 >>f() 0 Argument a in function f() is set at default value of 0, if it is not passed to the function at the function call. I get this! :) I also