comparison python/mutable_defaults.py @ 184:434c65593612

link to documentation
author Jeff Hammel <jhammel@mozilla.com>
date Sun, 11 Dec 2011 11:28:06 -0800
parents 70544c7406e2
children
comparison
equal deleted inserted replaced
183:748c232c0af3 184:434c65593612
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2
3 # see also: http://www.daniweb.com/software-development/python/threads/66697
2 4
3 class Foo(object): 5 class Foo(object):
4 def __init__(self, mutable=['default']): 6 def __init__(self, mutable=['default']):
5 self.foo = mutable 7 self.foo = mutable
6 self.foo.append(1) 8 self.foo.append(1)