Pass variable by reference

Steven D'Aprano steve+comp.lang.python at pearwood.info
Tue May 6 21:14:02 EDT 2014


On Tue, 06 May 2014 16:31:35 -0400, Ned Batchelder wrote:

> 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?

It's Javascript, which is barely one step up from PHP regarding 
consistency. It could mean "constant" for all I know :-)




-- 
Steven D'Aprano
http://import-that.dreamwidth.org/



More information about the Python-list mailing list