How to best explain a "subtle" difference between Python and Perl ?

Palindrom demarcheb at
Tue Aug 12 18:17:33 CEST 2008

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 = []


print liste# she expected liste to be an empty list

### Perl ###

@lst =(1,2,3);
$liste =\@lst;
print "@lst\n";

sub foo {

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,

More information about the Python-list mailing list