Problem with assigning variables of type List

Peter Hansen peter at engcorp.com
Tue Aug 20 01:08:52 CEST 2002


Max M wrote:
> 
> List and other complex objects are passe via reference and not by value
> for performance reasons.

Isn't it the case that *everything* is passed by reference in Python?
The only important thing is whether the object for which the reference 
is being passed is mutable or not.  For non-mutable objects, it looks 
a lot like pass-by-value and can lull you away from your state of 
vigilance about such issues.  Then you go and pass in a mutable like 
a list and you get into trouble.

-Peter



More information about the Python-list mailing list