Grumpy-pants spoil-sport [was Re: [Tutor] beginning to code]

Ned Batchelder ned at nedbatchelder.com
Mon Sep 25 12:54:46 EDT 2017


On 9/25/17 12:29 PM, Steve D'Aprano wrote:
> Regardless of whether I'm using Python, Swift, Java, C, Pascal or Scheme, if I
> write something like:
>
> x = Parrot(name="Polly")
>
> (using Python syntax for simplicity) and somebody tries to tell me that the
> value of x is anything but a Parrot instance named "Polly", I have no time for
> that sort of nonsense. They might as well tell me that I'm typing this response
> on an elephant.

But in this line:

     x = 2 + 2

You can say,

     the value of x is 4

or,

     the value of x is an int object with a value of 4

or,

     the value of x is a reference to an int object with a value of 4,

and in some ways, each of those is a correct statement. They are 
different perspectives on the same complicated abstract relationships 
inside your program.  Most of the disagreements in this thread stem from 
someone picking one of those three statements and insisting that it is 
*the* right statement, or from differing interpretations of words like 
value, reference, pointer, alias, etc.

Software gets complicated because it involves multiple levels of 
abstraction layered on top of each other.  We might as well be arguing 
like this:

     A: "The gas pedal makes the car go"

     B: "Nonsense! The gas pedal supplies fuel to the engine, it's the 
engine that makes the car go"

     C: "None of you know what you are talking about! The engine merely 
turns the axle. It's the wheels that make the car go!"

     D: "The wheels only work because of the friction between rubber and 
asphalt!"

etc etc etc.

--Ned.



More information about the Python-list mailing list