New submission from Xiaoqing Rong:

I was using IDLE (Python GUI) for Python 3.3.3. I don't know if this is a bug 
or you guys intend it to be this way:

>>> x=[1,2]
>>> y=x
>>> y.append(3)
>>> x
[1, 2, 3]

personally i'd prefer x stays as [1,2] when i'm trying to mutate y

also:
>>> def f1(m,n=['haha']):
        if m==n:
                print('m==n')
        else:
                print('m!=n')
        n.append('yaya')
        
>>> f1(['haha'])
m==n
>>> f1(['haha'])
m!=n

I'd prefer getting consistent results when calling functions like f1

----------
messages: 207410
nosy: m123orning
priority: normal
severity: normal
status: open
title: mutate list
type: behavior
versions: Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20135>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to