interactive help on the base object

Steven D'Aprano steve at pearwood.info
Mon Dec 9 06:11:58 CET 2013


On Sun, 08 Dec 2013 15:01:59 -0800, Mark Janssen wrote:

> On Sun, Dec 8, 2013 at 2:33 AM, Steven D'Aprano
> <steve+comp.lang.python at pearwood.info> wrote:
>> On Sat, 07 Dec 2013 20:21:06 -0800, Mark Janssen wrote:
>>
>>>>>> Is it just me, or is this basically useless?
>>>>>>
>>>>>> class object
>>>>>>  |  The most *base* type
>>>>>
>>> [[Terry Reedy:]]
>>>> How about something like.
>>>> The default top *superclass* for all Python classes.
>>>
>>> How 'bout you foo<l>s just admit that you didn't realize you've been
>>> confused this whole time?  (It *is* possible isn't it?)
>>>
>>> Mr. Ewing says "base" has to be interpreted as an *adjective* because
>>> otherwise it would mean the BOTTOM (like the BASE of the pyramid),
>>> while Terry responds that it is the TOP (*super*class).  Earlier,
>>> Steven D'Aprano wanted to argue that this distinction was irrelevant,
>>
>> What are you talking about? Until this very post, I haven't made any
>> comments in this thread.
> 
> It was a few months ago.  You do know what I'm talking about because you
> just expounded with the exact same argument below.  It's like a broken
> record.

While I am gratified that you apparently memorise and obsess over things 
I wrote months ago, I'm sorry to tell you that I wasn't lying when I said 
that I didn't know what you were talking about. I had no idea that you 
were referring to a completely different conversation, nor do I recall 
every post I write here.

If I repeated the same argument, it is because the argument is still 
valid. Drawing the root of the tree at the top of the page is just a 
convention, just driving on the left side of the road, or calling the 
elected head of state "Prime Minister". There are other ways to do such 
things which are equally valid, and so long as both parties agree on the 
convention, it doesn't matter whether you write from left-to-right like 
in Australia, right-to-left like in Egypt, or alternate like in Israel.


> (Now if *I* sound like a broken record, it's because no seems
> to see the obvious, but carry on.)

It must be such a trial to be the only sane man in a world gone mad.


[...]
>> What matters is the relationships between the entities, not the
>> specific direction they are drawn in relative to some imaginary
>> absolute space. [yadda, yagni, yadda]
> 
> But, there IS A DIFFERENCE.  Let me explain the concept of a object
> model (or "type model" if you prefer).
> 
> In a family inheritance tree,  there is this difference -- called the
> "calendar" --  which imposes an ordering which can't be countermanded by
> flipping your silly chart around.  You made a bullshit example to simply
> argue a point and *fooled yourself* into ignoring this.  Yes?

No. You haven't explained anything, you have merely made an assertion 
with no supporting evidence at all.

In a family tree of ancestors and descendants, the relationship being 
draw is time-based. Ancestors exist before descendants. Descendants are 
derived in some way from ancestors, not the other way around. We all 
agree that your father existed before you. The temporal direction of the 
relationship is absolutely fixed, past before present, ancestors before 
descendants. We can agree on this.

Explain to me this: what (apart from mere human convention) imposes the 
ordering "past must be at the top of the page"?

If you are reading this as email, your mail client very likely has an 
option to sort message in order that they were received, either most-
recent at the top or oldest at the top. Do you really mean to imply that 
one of those is logical and the other is delusional?


> Likewise, WITH A COMPUTER, there is a definite order which can't be
> countermanded by simply having this artifice called "Object". If you
> FEE(L)s hadn't noticed (no longer using the insult "foo"s out of respect
> for the sensativities of the brogrammers), this artifice has just been
> *called on the floor* with this little innocent question that fired up
> this discussion again (don't hate the messenger). Again:  people
> entering the community are pointing out a problem -- that Object is both
> trying to be the BASE and the SUPERclass of all objects.

How is this a problem? They mean the same thing.

A television is both an appliance and a device. object is both the base 
class and a superclass of all other classes.


> CS554: A type/object *model* has to define the relationship of these
> nice abstractions so that they can be mapped to the *actual
> concreteness* of the machine.  And there, bro, there is an ordering.

Yes, the ordering is that the subclass is derived from the superclass. 
Nobody disputes that. But we can show that relationship using any 
convention we like:


superclass -> subclass 

subclass <- superclass 

"superclass extended by subclass"

"subclass extends superclass"

superclass
   ↓
subclass


subclass
   ↑
superclass


Python syntax:
    class MySubclass(MySuperclass): ...


Smalltalk syntax:
    MySuperclass :subclass #MySubclass


Java syntax:
    class MySubclass extends MySuperclass {...}



> You're not going to magically flip the hierarchy so that your bitless
> Object becomes a machine word that is the base of all your types.

You seem to be labouring under the delusion that inheritance, which is a 
high-level concept which only applies to objects, goes "all the way down" 
to low-level concepts like words and bits.

Objects do not *inherit* from bits. They are *composed* of bits.


> You've
> been fooled by the magic of the Turing Machine.   The modern computer
> mollifies you with the illusion of "total abstraction" where there are
> no bits or 1s and 0s involved, but yea, it did not turn out that way. 
> (Note bene: as a comparison, C++ is very UNAMBIGUOUS about this fact --
> all objects inherit from concrete machine types, which is why it remains
> important, *despite* being one of the worst to do OOP in.  Its *type
> model* is probably the most clear of any object-oriented language).

You haven't actually programmed in C++ have you?

There's no shame in answering that you haven't. I've never programmed in 
C++. It's on my to-do list, after giving myself an appendectomy with a 
dull rusty knife and just ahead of buying the complete collection of 
Justin Bieber albums. But even I know that you cannot inherit from native 
types, on account that they aren't objects.


>> Likewise it doesn't matter whether we draw class hierarchies from the
>> top down or the bottom up or even sidewise:
> 
> Have you caught it by now, friends:  IT MATTERS TO THE COMPUTER.

How the hell does the computer know which way I draw my class diagrams?



-- 
Steven



More information about the Python-list mailing list