Can global variable be passed into Python function?

Mark H. Harris harrismh777 at gmail.com
Thu Feb 27 18:29:01 EST 2014


On Thursday, February 27, 2014 11:54:44 AM UTC-6, Ned Batchelder wrote:

> Mark, thanks for helping to answer the OP's question.  We've covered (in 
> depth) in the rest of this thread, that Python *does* have the concept 
> of a variable, it just behaves differently than some other popular  
> programming languages (but exactly the same as some other popular 
> programming languages!)
> 

I do not disagree.  I've had the same discussion over the years since using python, and often its a rope soaking contest...  some folks get so enamored with the 'way' it works under the covers that they forget how people think about it as they are trying (as normal people) to use the language (instead of BASIC). 

So, yeah,  thinking about variables is just not going away.

I finally decided (in my own head) that I would completely give up on the 'variable' concept (intellectually)  and help folks try to understand references and reference counting. Knowing that A points to an int, and that B=A, now B points to the VERY SAME int...  they are references pointing to the same piece of memory. And of course we want new folks to understand the issue of:
A==B
True
A is B
False
    .....   and WHY that is or isn't....    

:)     

it just helps to get the 'variable' idea out of here... it really is something completely different in python.

Thanks for the note,   
kind regards,
marcus



More information about the Python-list mailing list