Is 'everything' a refrence or isn't it?

Steven D'Aprano steve at REMOVETHIScyber.com.au
Thu Jan 5 20:01:09 EST 2006


On Wed, 04 Jan 2006 22:51:03 -0500, Mike Meyer wrote:

>> And if you only ever passed immutable objects around, you would
>> think Python was call by value.
> 
> You might. Then again, you might also understand the concepts well
> enough to realize that there isn't any difference between CBR and CBV
> when you're passing immutable objects.

Consider this:

def do_nothing(x):
    pass

huge_tuple = (None,) * 10000**4
do_nothing(huge_tuple)

If Python made a copy of huge_tuple before passing it to the function, you
would notice.



-- 
Steven.




More information about the Python-list mailing list