Finding the instance reference of an object

Steve Holden steve at holdenweb.com
Fri Nov 7 00:44:21 EST 2008


Steven D'Aprano wrote:
> On Thu, 06 Nov 2008 09:59:37 -0700, Joe Strout wrote:
[...]
> And by definition, "call by value" means that the parameter is a copy. So 
> if you pass a ten megabyte data structure to a function using call-by-
> value semantics, the entire ten megabyte structure is copied.
> 
> Since this does not happen in Python, Python is not a call-by-value 
> language. End of story.
> 
> 
>  
>> Without knowing that, you don't know what assignments to the formal
>> parameter will do, or even what sort of arguments are valid. Answer:
>> it's a copy of it.  
> 
> Lies, all lies. Python doesn't copy variables unless you explicitly ask 
> for a copy. That some implementations of Python choose to copy pointers 
> rather than move around arbitrarily large blocks of memory instead is an 
> implementation detail. It's an optimization and irrelevant to the 
> semantics of argument passing in Python.
[...]

Are you sure you meant to write this?

regards
 Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list