A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2001-May/014541.html below:

[Python-Dev] Classes and Metaclasses in Smalltalk

[Python-Dev] Classes and Metaclasses in SmalltalkDonald Beaudry Donald Beaudry <donb@abinitio.com>
Wed, 02 May 2001 11:37:39 -0400
"Fredrik Lundh" <fredrik@effbot.org> wrote,
> thomas wrote:
> 
> > > why not spell it out:
> > > 
> > >     self.__super__.foo(arg1, arg2)
> > > 
> > > or
> > > 
> > >     self.super.foo(arg1, arg2)
> > > 
> > > or
> > > 
> > >     super(self).foo(arg1, arg2)
> >
> > IMO we still need to specify the class, and there we are:
> > 
> >      super(self, MyClass).foo(arg1, arg2)
> 
> isn't that the same as self.__class__ ?  in which case
> super is something like:

super is a lexically scoped concept.  You cant ask the instance for it
since it's value is different depending on in which it is needed Just
as:

        class foo(bar):
              def __repr__(self):
                  return self.__class__.__repr__(self)

would get you into an infinite loop, while:

        class foo(bar):
              def __repr__(self):
                  return bar.__repr__(self)

wont.  Now, dont go thinking that

        class foo(bar):
              def __repr__(self):
                  return self.__class__.__base__[0].__repr__(self)

will do you any good either ;) Because it wont!

--
Donald Beaudry                                     Ab Initio Software Corp.
                                                   201 Spring Street
donb@init.com                                      Lexington, MA 02421
                  ...So much code, so little time...



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4