Passing arguments to function - (The fundamentals are confusing me)
roccomoretti at hotpop.com
Tue Aug 9 17:39:29 CEST 2005
Christopher Subich wrote:
> Gregory Piñero wrote:
>> Hey guys, would someone mind giving me a quick rundown of how
>> references work in Python when passing arguments into functions? The
>> code below should highlight my specific confusion:
This URL is always tossed out:
> All arguments are passed by reference, but in Python equality rebinds
> the name.
>> Why does my list variable get changed for the rest of the program, but
>> my boolean variable doesn't. What am I not understanding?
Booleans are immutable, lists are mutable. You change (mutate) the same
list, but you are referencing a different (immutable) Bool
> In Python, "x = y" has a very definite meaning of "y is assigned to the
> name of x."
Change it to "the object referenced by y is assigned to the name of x",
and you're closer to the truth.
More information about the Python-list