Reductionism gone mad [was Re: Call by binding]

Steve D'Aprano steve+python at pearwood.info
Mon Sep 25 21:01:54 EDT 2017


On Tue, 26 Sep 2017 05:35 am, Marko Rauhamaa wrote:

> Chris Angelico <rosuav at gmail.com>:
> 
>> On Tue, Sep 26, 2017 at 12:26 AM, Marko Rauhamaa <marko at pacujo.net> wrote:
>> Sorry, that was my bad in the terminology. But where do you get that
>> all Python expressions evaluate to pointers?
> 
> What do they evaluate to if not pointers?

That's a remarkable question. I understand that you may have used Python once or
twice in the past. In all that time, have you ever, even once, needed to
dereference a pointer? Or use an "address of" operator? Does Python even
provide such functionality?

When you evaluate, say, `chr(65)`, at the interactive interpreter, which of the
following is closer to what you see?


py> chr(65)  # evaluates to a pointer, as Marko says
<pointer to 0x274ab5f4>

py> chr(65)  # what actually happens
'A'


Evaluating python expressions results in an object, not a pointer. You are
mixing up implementation of an abstraction (the Python virtual machine) with
the interface to that Python VM.

Concepts such as "expressions" are part of the interface between the human coder
and the Python VM. Concepts such as "pointers" are part of the implementation
of how the VM works at a lower level.

Talking about the implementation is perfectly fine. What is not fine is the
stubborn insistence that the implementation is the interface.

And of course, pointers themselves are only a lower-level abstraction. They're
actually just integers. So using your technique of inappropriately dropping
into a lower abstraction, we can say that "Python expressions always evaluate
to integers".

But of course even that is just an abstraction too, integers are actually just a
block of bytes. So we could say that "Python expressions always evaluate to
bytes".

But that is also just an abstraction. What actually happens is that a set of
(possibly non-contiguous) memory cells are set. So we could say that "Python
expressions don't evaluate to anything, they operate purely by side-effect by
setting a set of memory cells".

But that's still an abstraction. How far down should we go before you
acknowledge the error of describing the behaviour of a higher abstraction in
terms of what happens in lower levels?

There's a term for this sort of category error: reductionism. I thought that
reductionism was dead: 

- you won't find doctors, not even specialists, denying that people 
  can walk across the room and insisting that all they do is contract
  muscle fibres;

- you won't find ecologists or biologists denying that there are such
  things as forests, only trees;

- or chemists denying that there are trees, only self-organising collections
  of molecules;

- or physicists denying that there are molecules, only quarks and electrons.


But apparently reductionism is alive and well in computing.


-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.




More information about the Python-list mailing list