the global keyword:

Ned Batchelder ned at nedbatchelder.com
Sat Jun 11 23:48:18 EDT 2016


On Saturday, June 11, 2016 at 11:38:33 PM UTC-4, Steven D'Aprano wrote:
> On Sun, 12 Jun 2016 11:26 am, Random832 wrote:
> 
> > On Sat, Jun 11, 2016, at 20:09, MRAB wrote:
> >> Not true. Importing doesn't copy the value.
> >> 
> >> Importing a name creates a new name in the local scope that refers to
> >> the same object that the imported name referred to.
> 
> MRAB is correct here.
> 
> 
> > Yes, the value of a variable is a reference to an object. Can we not
> > have another round of this right now?
> 
> Sure, if you stop spreading misinformation about variables in Python and
> cease the insanity of claiming that the value of a variable is not the
> value you assign to it, but some invisible, unreachable "reference".
> 
> x = 999
> 
> The value of x is 999, not some invisible reference.
> 
> x = []
> 
> The value of x is an empty list, not some invisible reference.

We just went through all this.  It's clear to me that there are different
ways of looking at these underlying mechanisms, and different people find
truth in different ways of describing them.  The virtual world we live in
is complex because of the differing levels of abstraction that are possible.
Some of this disagreement is really a matter of choosing different
abstractions to focus on.

Most importantly, it's clear to me that we aren't going to come to some
simple consensus, certainly not by throwing around words like "insanity."

Perhaps at least in this thread we can limit ourselves to addressing the
OP and their question directly, rather than fighting with each other over
which answer is correct?

--Ned.


More information about the Python-list mailing list