reference or pointer to some object?
Paul Rubin
http
Tue Jan 11 01:46:01 EST 2005
Torsten Mohr <tmohr at s.netic.de> writes:
> i'd like to pass a reference or a pointer to an object
> to a function. The function should then change the
> object and the changes should be visible in the calling
> function.
Normally you would pass a class instance or boxed object, and let the
function change the instance or object:
def bump(b):
b[0] += 123 # change
x = [5]
bump(x)
print x # prints [128]
More information about the Python-list
mailing list