Say this:
class tester():
_someList = [0, 1]
def __call__(self):
someList = self._someList
someList += "X"
return someList
test = tester()
But guess what, every call adds to the variable that I am trying to
copy each time:
test()
> [0, 1, 'X']
test()
> [0, 1, 'X', 'X']
Can someone explain this behavior? And how to prevent a classwide
constant from ever getting changed?
-- Gnarlie
--
http://mail.python.org/mailman/listinfo/python-list
opensubscriber is not affiliated with the authors of this message nor responsible for its content.