Mutability of function arguments?

Carl J. Van Arsdall cvanarsdall at mvista.com
Wed Dec 7 19:26:56 EST 2005



>
> And, indeed, would that approach work? Would declaring:
>
> class FooWrapper :
>     __init__(fooToLoad) :
>         self.foo = fooToLoad
>
> mean that I could now declare a FooWrapper holding a foo, pass the
> FooWrapper to a function, and have the function conclude with the foo
> within the FooWrapper now modified?
>   
Yes, passing FooWrapper will pass by reference to a python function 
thereby allowing you to edit the fooToLoad

HTH,

carl


-- 

Carl J. Van Arsdall
cvanarsdall at mvista.com
Build and Release
MontaVista Software




More information about the Python-list mailing list