Pass variable by reference

Ned Batchelder ned at nedbatchelder.com
Tue May 6 16:31:35 EDT 2014


On 5/6/14 12:42 AM, Gary Herron wrote:
> This gets confusing, but in fact the most accurate answer is that Python
> does not have "variables", so there is no such thing as passing
> "variables" by reference or any other method.  Python *does* have names
> bound to values, but that's a very different thing. If necessary, you
> may consider that the *values* are passed by reference.

This meme bugs me so much.  Python has variables.  They work differently 
than variables in C.  In fact, they work by having names bound to values.

If you want to insist that Python has no variables, you will have to 
also say that neither do Javascript, Ruby, Java, PHP, etc.  And if 
Javascript has no variables, what does the var keyword mean?

-- 
Ned Batchelder, http://nedbatchelder.com




More information about the Python-list mailing list