Here's an object-oriented approach that works much the same way...
-- Box.py --
class Box:
def __init__(self, value):
self.value=value
def get(self):
return self.value
def set(self,value):
self.value=value
def __repr__(self):
return 'Box(' + `self.value` + ')'
-- cut here --
>>> from Box import *
>>> x=Box(3)
>>> def makeitfour(foo):
... foo.set(4)
...
>>> makeitfour(x)
>>> x.get()
4
>>> x
Box(4)
-- Steven Miale - smiale@cs.indiana.edu | Don't blame me - Indiana University, Bloomington, IN | I voted Libertarian.