Python handles globals badly.

Mark Lawrence breamoreboy at yahoo.co.uk
Sat Sep 12 07:54:06 CEST 2015


On 12/09/2015 06:35, Random832 wrote:
> Mark Lawrence <breamoreboy at yahoo.co.uk> writes:
>> Let's put it another way, in the 15 years I've been using Python I do
>> not recall any experienced Python programmer using "pointer", so what
>> makes you think, in 2015, that you are correct and everybody else is
>> wrong?  I still say that everything in Python is an object, and should
>> add that it has one or more things, "names", that are associated with
>> it.  Hence my preferred analogy about the sticky note.
>
> So is player3[3] also a name, a sticky note? What if we copy player3 to
> another name; does it get two sticky notes, player3[3] and foo[3]? Your
> "sticky note" analogy doesn't unify variables/names/whatever you want to
> call them with other places that you can assign stuff to, and it implies
> that the objects themselves have knowledge of their "names", and that
> names are global (if I have two functions each with a result variable,
> does that mean there are two different result sticky notes?)
>
> It doesn't matter that a pointer isn't what it's *called*, it's what it
> *is*. And it's not an object, because you can copy it to more than one
> place with only one object.
>

There is NO CONCEPT in Python of a "pointer".  player3[3] is the fourth 
item of a list or similar, or a reference to something in a dictionary, 
but regardless of the type it is an object that has a name player3. 
player3 then gets copied to foo.  Both names are referring to the same 
object.  It certainly DOES NOT imply anything about objects having 
knowledge of their names and it DOES NOT say anything about the scope of 
names.  As for "two functions each with a result variable" I haven't the 
faintest notion what you could be talking about, would you please 
explain for the benefit of everybody reading this thread.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence



More information about the Python-list mailing list