"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]
>>
>>
<[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
<[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]:
>> 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
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