Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > interactive help on the base object

Reply
Thread Tools

interactive help on the base object

 
 
Mark Lawrence
Guest
Posts: n/a
 
      12-06-2013
Is it just me, or is this basically useless?

>>> help(object)

Help on class object in module builtins:

class object
| The most base type

>>>


Surely a few more words, or a pointer to this
http://docs.python.org/3/library/functions.html#object, would be better?

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

Mark Lawrence

 
Reply With Quote
 
 
 
 
Gregory Ewing
Guest
Posts: n/a
 
      12-08-2013
Mark Lawrence wrote:
> Is it just me, or is this basically useless?
>
> class object
> | The most base type


It's also a somewhat strange construction from an English language
point of view. To make sense, it requires interpreting the word
"base" as an adjective, and when used that way it has connotations
of something to turn your nose up at. I'm assuming that's not the
impression we want to give!

Maybe something like "The ultimate base class of all classes"
would be better.

--
Greg
 
Reply With Quote
 
 
 
 
Ned Batchelder
Guest
Posts: n/a
 
      12-08-2013
On 12/7/13 7:10 PM, Gregory Ewing wrote:
> Mark Lawrence wrote:
>> Is it just me, or is this basically useless?
>>
>> class object
>> | The most base type

>
> It's also a somewhat strange construction from an English language
> point of view. To make sense, it requires interpreting the word
> "base" as an adjective, and when used that way it has connotations
> of something to turn your nose up at. I'm assuming that's not the
> impression we want to give!
>
> Maybe something like "The ultimate base class of all classes"
> would be better.
>


I've heard this described as "the root of the class hierarchy."

--
Ned Batchelder, http://nedbatchelder.com

 
Reply With Quote
 
Mark Janssen
Guest
Posts: n/a
 
      12-08-2013
>>> 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,
but obviously it can't very well be both at once now cannit?

Could-the-world-be-so-crazy-confused-and-then-shoot-the-messenger?

Sadly, yes.

MarkJ
Tacoma, Washington
 
Reply With Quote
 
Steven D'Aprano
Guest
Posts: n/a
 
      12-08-2013
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.


> but obviously it can't very well be both at once now cannit?


Of course it can. To people in the southern hemisphere, the South Pole is
at the top of the world and the North Pole is at the bottom. For people
in the northern hemisphere, it's the opposite, with the North Pole being
"up" and the South Pole being "down".

http://cdn.shopify.com/s/files/1/007..._world_map.png


Family trees and other hierarchies, including class inheritance diagrams,
have a *relative* direction not an absolute direction. We can all agree
that Fred and Wilma are the parents of Pebbles, but it doesn't really
matter whether we draw the family tree like this:


Fred Wilma (diagrams best viewed in a fixed-width font
| | like Courier, Monaco or Lucinda Typewriter)
+----+----+
|
Pebbles


(inheritance goes *down* the page from ancestors to descendants)

or like this:

Pebbles
|
+----+----+
| |
Fred Wilma


(inheritance goes *up* the page from ancestors to descendants).

What matters is the relationships between the entities, not the specific
direction they are drawn in relative to some imaginary absolute space.
Likewise it doesn't matter whether we draw class hierarchies from the top
down or the bottom up or even sidewise:

object --> int --> myint

is the same as:

myint <-- int <-- object


Ironically, although it is conventional to draw the most distant ancestor
at the *top* of the page, it is called the *base* or *root* of the tree.


This Way Up
||
||
||
\ || /
\||/





--
Steven

 
Reply With Quote
 
Ned Batchelder
Guest
Posts: n/a
 
      12-08-2013
On 12/7/13 11:21 PM, 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?)


Mark, if you want to participate in this forum, please refrain from
opening with an insult. I've tried talking with you here in the past,
and got nothing but sarcastic sneers and put-downs for my trouble.

I gave you the benefit of the doubt, and believed that previous
contentious points (no tokens on punched cards, initializing arrays to
NaN, etc) were due to misunderstandings that could be worked out. You
treated me with contempt and refused to discuss the details that would
have let us understand each other.

I know you have a theory that all of computer science has been confused
for half a century. You expounded on this before, but haven't managed
to explain your point clearly, and have not convinced anyone that you
have a better model than the ones we're already using.

Perhaps we are confused, and you have a better idea. I don't know yet,
though frankly I doubt it. I'd be glad to learn about your ideas, but
you have to present them seriously, and with some humility, to get them
to spread. So far, repeated attempts to get details from you have failed.

>
> 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,
> but obviously it can't very well be both at once now cannit?
>
> Could-the-world-be-so-crazy-confused-and-then-shoot-the-messenger?
>
> Sadly, yes.


I'm sorry you feel martyred. It's not because you bring truth to
crazy-confused people. It's because you can't explain yourself, and you
push people away with your style.

We try hard to treat each other with respect, and I'll ask you to do the
same.

>
> MarkJ
> Tacoma, Washington
>


--
Ned Batchelder, http://nedbatchelder.com

 
Reply With Quote
 
Mark Janssen
Guest
Posts: n/a
 
      12-08-2013
On Sun, Dec 8, 2013 at 2:33 AM, Steven D'Aprano
<(E-Mail Removed)> 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. (Now if *I* sound like a broken record, it's because
no seems to see the obvious, but carry on.)

>> but obviously it can't very well be both at once now cannit?

>
> Family trees and other hierarchies, including class inheritance diagrams,
> have a *relative* direction not an absolute direction. We can all agree
> that Fred and Wilma are the parents of Pebbles, but it doesn't really
> matter whether we draw the family tree like this:
>
>
> Fred Wilma (diagrams best viewed in a fixed-width font
> | | like Courier, Monaco or Lucinda Typewriter)
> +----+----+
> |
> Pebbles
>
>
> (inheritance goes *down* the page from ancestors to descendants)
>
> or like this:
>
> Pebbles
> |
> +----+----+
> | |
> Fred Wilma
>
>
> (inheritance goes *up* the page from ancestors to descendants).
>
> 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?

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.

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.
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'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).

> 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.
With some apologies for Ned for attempting to be neutral. Apparently
you guys are philosophers more than Computer Engineers.

MarkJ
Tacoma, Washington
 
Reply With Quote
 
Gregory Ewing
Guest
Posts: n/a
 
      12-08-2013
Mark Janssen wrote:
> Mr. Ewing says "base" has to be interpreted as an *adjective* because
> otherwise it would mean the BOTTOM (like the BASE of the pyramid),


Not exactly -- a native English speaker would say something
like "the bottommost class" if that's what they meant.

Or they would say "the most basic class" to mean the simplest
one -- but that's not quite what we mean either.

The only way that "most base class" makes grammatical sense
is if you interpret "base" as meaning "undesirable", as in
"base metal" (i.e. a non-precious metal), "base instinct"
(the kind of animal urges that humans are meant to be too
good for), etc.

> while Terry responds that it is the TOP (*super*class).


Yeah, "top" or "bottom" only conveys the right idea if you
assume the diagram is drawn a particular way up. Which is
why I like the term "base class" -- you just need to be
careful with the grammar!

--
Greg
 
Reply With Quote
 
Chris Angelico
Guest
Posts: n/a
 
      12-09-2013
On Mon, Dec 9, 2013 at 10:01 AM, Mark Janssen <(E-Mail Removed)> wrote:
> (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).


Factually wrong. In C++, it is actually *impossible* to inherit from a
"concrete machine type", by which presumably you mean the classic
types int/char/float etc.

struct foo: public int
{
foo() {}
};

1.cpp:1:20: error: expected class-name before ‘int’
1.cpp:1:20: error: expected ‘{’ before ‘int’
1.cpp:2:1: error: expected unqualified-id before ‘{’ token

Okay, that's a parse error. Maybe if we avoid the language keyword?

typedef int integer;

struct foo: public integer
{
foo() {}
};

1.cpp:4:1: error: expected class-name before ‘{’ token

Nope. There are two completely different groups here: the basic types
(called here [1] "Fundamental data types") and the structure types.
The latter are created by the struct/class keyword and can use
inheritance. The former... aren't. Not every C++ type is part of the
type hierarchy.

This is actually somewhat true of Python, too, but the set of types
that are unavailable for inheritance is much smaller and less useful.
You can't inherit from the 'function' type, for instance:

>>> class foo(type(lambda:1)):

pass

Traceback (most recent call last):
File "<pyshell#80>", line 1, in <module>
class foo(type(lambda:1)):
TypeError: type 'function' is not an acceptable base type

And yet <class 'function'> inherits from class <'object'>, so it's not
entirely outside in the way C++ int is. And I can apparently subclass
module, though not generator, and unsurprisingly NoneType can't be
inherited from. (Though you can instantiate it, and it's probably the
only class that will appear to have no return value from
instantiation.)

C++ has you *compose* structs/classes from primitives, but this is not
the same as inheritance. They're completely separate concepts.

ChrisA

[1] http://www.cplusplus.com/doc/tutorial/variables/
 
Reply With Quote
 
Mark Janssen
Guest
Posts: n/a
 
      12-09-2013
On Sun, Dec 8, 2013 at 6:44 PM, Chris Angelico <(E-Mail Removed)> wrote:
> On Mon, Dec 9, 2013 at 10:01 AM, Mark Janssen <(E-Mail Removed)> wrote:
>> (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).

>
> Factually wrong. In C++, it is actually *impossible* to inherit from a
> "concrete machine type", by which presumably you mean the classic
> types int/char/float etc.


Wow, you guys trip me out, but I guess I've been working in a
different universe where I was mapping classes into basic types (using
generic programming along with typedef). I'm going to have to
re-think all this confusion.

But, in any case, if you don't have a way to map your abstract objects
into machine types, you're working on magic, not computer science.

MarkJ
Tacoma, Washington
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
The node.js Community is Quietly Changing the Face of Open Source Rodrick Brown Python 2 04-17-2013 04:47 PM
Re: The node.js Community is Quietly Changing the Face of Open Source Ned Batchelder Python 0 04-16-2013 04:25 PM
Is there a difference between the use of the word montage vscollage Danny D. Digital Photography 8 04-15-2013 02:24 PM
Windows 8 - so bad it's hastening the death of the PC? ~misfit~ NZ Computing 18 04-15-2013 04:15 AM
Object creation - Do we really need to create a parent for a derieved object - can't the base object just point to an already created base object jon wayne C++ 9 09-22-2005 02:06 AM



Advertisments