Hi everyone !

I'd like to apologize in advance for my bad english, it's not my
mother tongue...

My girlfriend (who is a newbie in Python, but knows Perl quite well)
asked me this morning why the following code snippets didn't give the
same result :

### Python ###

liste = [1,2,3]

def foo( my_list ):
    my_list = []

foo(liste)

print liste# she expected liste to be an empty list

### Perl ###

@lst =(1,2,3);
$liste [EMAIL PROTECTED];
foo($liste);
print "@lst\n";

sub foo {
 my($my_list)[EMAIL PROTECTED];
 @{$my_list}=()
}

I have to admit that I don't know how to clearly explain to her the
differences between these results.
Could someone please help us understand these difference between
Python and Perl ?

Thanks in advance,
P4|1ndr0m
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to