Python Programming Ettiquette

zzzzz zzizz_ at notmail.com
Thu Apr 12 02:06:07 EDT 2001


On Thu, 12 Apr 2001 15:45:00 +1000, zzzzz <zzizz_ at notmail.com> wrote:


>a) Directly modify the parameter:
>x=[1,2,3]
>def add4tolist(inputlist):
>   inputlist.append(4)
>add4tolist(x)
>x
>[1,2,3,4]

<snip>

>a) is simpler, however, it only works on immutable type

oops make that mutable!!!!!!!
Regards,

zzzzz.
---------------------



More information about the Python-list mailing list