[issue9702] Python violates most users expectations via the modification differences of immutable and mutable objects in methods

david report at bugs.python.org
Fri Aug 27 17:11:55 CEST 2010


david <db.pub.mail at gmail.com> added the comment:

def list_again(foo):
	foo.append("bar")

def list_again_again(foo):
	foo = foo + ["1"]

if __name__ == "__main__":
	bar = []
	list_again(bar)
	print bar
	list_again_again(bar)
	print bar



Ok so let me without running the above code exactly what it does AND then, stop and think about how *most* coders expect it to behave.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9702>
_______________________________________


More information about the Python-bugs-list mailing list