Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #91721 > unrolled thread

Re: Language design

Started byTheDoctor <dreamingforward@gmail.com>
First post2015-06-01 14:45 -0700
Last post2015-06-02 11:08 -0700
Articles 3 — 3 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Language design TheDoctor <dreamingforward@gmail.com> - 2015-06-01 14:45 -0700
    Re: Language design Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-06-02 17:25 +1000
      Re: Language design "Dr. Bigcock" <dreamingforward@gmail.com> - 2015-06-02 11:08 -0700

#91721 — Re: Language design

FromTheDoctor <dreamingforward@gmail.com>
Date2015-06-01 14:45 -0700
SubjectRe: Language design
Message-ID<a703cea2-ef76-4a47-81ba-3ddcbfcd2c06@googlegroups.com>
On Wednesday, September 11, 2013 at 6:40:22 PM UTC-5, Steven D'Aprano wrote:
> On Wed, 11 Sep 2013 14:30:54 -0700, Mark Janssen wrote:
> 
> > 1) It tried to make Object the parent of every class.  
> 
> Tried, and succeeded.

Oh?  How about:

class superdict(dict):  
    """I'm going to extend the dict type to include extra methods."""

class mixin():
   """Here we go."""

What is the parent of mixin?

> > No one's close enough to God to make that work.
> 
> Non-sequitor. One doesn't need to be close to a deity to have a single 
> root of the object hierarchy.

Loud voice:  Boom!

> > 4?) It allowed
> > [reference] variables to be used as dict keys.  This creates a parsing
> > difficulty for me, mentally.  Keys should be direct, hashable values,
> > not hidden in a variable name.
> 
> I don't even understand what you are talking about here. "[reference] 
> variables"? What does that mean?

Nevermind.  I was wrong on this one.  My mental lexer threw an error on this one whenever ppl used a variable as a key.

Cheer!

Mark

[toc] | [next] | [standalone]


#91807

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2015-06-02 17:25 +1000
Message-ID<556d5a6d$0$11122$c3e8da3@news.astraweb.com>
In reply to#91721
On Tuesday 02 June 2015 07:45, TheDoctor wrote:

> On Wednesday, September 11, 2013 at 6:40:22 PM UTC-5, Steven D'Aprano
> wrote:
>> On Wed, 11 Sep 2013 14:30:54 -0700, Mark Janssen wrote:
>> 
>> > 1) It tried to make Object the parent of every class.
>> 
>> Tried, and succeeded.
> 
> Oh?  How about:
> 
> class superdict(dict):
>     """I'm going to extend the dict type to include extra methods."""
> 
> class mixin():
>    """Here we go."""
> 
> What is the parent of mixin?

Why don't you try for yourself and see?


py> class mixin():
...     """Here we go."""
... 
py> mixin.__bases__
(<class 'object'>,)
py> mixin.__base__
<class 'object'>
py> mixin.__mro__
(<class '__main__.mixin'>, <class 'object'>)





-- 
Steve

[toc] | [prev] | [next] | [standalone]


#91874

From"Dr. Bigcock" <dreamingforward@gmail.com>
Date2015-06-02 11:08 -0700
Message-ID<a0e03694-d03e-4062-971c-46d5567b5f92@googlegroups.com>
In reply to#91807
On Tuesday, June 2, 2015 at 2:25:43 AM UTC-5, Steven D'Aprano wrote:
> On Tuesday 02 June 2015 07:45, TheDoctor wrote:
> 
> > On Wednesday, September 11, 2013 at 6:40:22 PM UTC-5, Steven D'Aprano
> > wrote:
> >> On Wed, 11 Sep 2013 14:30:54 -0700, Mark Janssen wrote:
> >> 
> >> > 1) It tried to make Object the parent of every class.
> >> 
> >> Tried, and succeeded.
> > 
> > Oh?  How about:
> > 
> > class superdict(dict):
> >     """I'm going to extend the dict type to include extra methods."""
> > 
> > class mixin():
> >    """Here we go."""
> > 
> > What is the parent of mixin?
> 
> Why don't you try for yourself and see?

> py> class mixin():
> ...     """Here we go."""
> ... 
> py> mixin.__bases__
> (<class 'object'>,)
> py> mixin.__base__
> <class 'object'>
> py> mixin.__mro__
> (<class '__main__.mixin'>, <class 'object'>)
> 

Python2.7:

>>> type(mixin)
<type 'classobj'>

It's a special classobj in v2.7 which doesn't have any attributes like __base__ or __mro__.

And yes, I'm bringing up old conversations, because don't you agree that it's better to return to old conversations than to re-create them all over again?

--m

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web