[Python-Dev] Class Methods

Moshe Zadka moshez@zadka.site.co.il
Sat, 21 Apr 2001 03:32:57 +0300


On Fri, 20 Apr 2001 11:26:01 -0500, Guido van Rossum <guido@digicool.com> wrote:
 
> For regular methods it may be possible to avoid this simply by
> choosing non-conflicting names, but I seem to recall that Jim wanted
> to use class methods with certain special names (like __init__ or
> __getattr__?), and I have no idea how to do this without dropping the
> idea that x.spam(...) is C.spam(x, ...).  So maybe that's the
> solution?

class A:

    def __init__(self):
        self.spam = 1

class B:

    def __init__(self):
        A.__init__(self)
        self.eggs = 2

-- 
"I'll be ex-DPL soon anyway so I'm        |LUKE: Is Perl better than Python?
looking for someplace else to grab power."|YODA: No...no... no. Quicker,
   -- Wichert Akkerman (on debian-private)|      easier, more seductive.
For public key, finger moshez@debian.org  |http://www.{python,debian,gnu}.org