[Tutor] Need Explanation...

Asokan Pichai pasokan at talentsprint.com
Sat Dec 10 09:11:11 CET 2011


On Sat, Dec 10, 2011 at 1:11 PM, sunil tech <sunil.techspk at gmail.com> wrote:
> hi,
>
> Consider a list: a = [1,2,3]
>
> & a simple function, which when called it will append 100 to the list.
>
> def app(x):
>      return x.append(100)
>
> p = app(a)
>
> now list holds appended value [1,2,3,100]
> but p is empty... why it is?
>
> please teach.
>
append() Method is a mutator; it modifies the list.

DOES NOT return the modified list; returns None
to be exact

HTH

Asokan Pichai


More information about the Tutor mailing list