[Python-Dev] Classes and Metaclasses in Smalltalk (original) (raw)
Guido van Rossum guido@digicool.com
Wed, 02 May 2001 10:19:07 -0500
- Previous message: [Python-Dev] Classes and Metaclasses in Smalltalk
- Next message: [Python-Dev] Classes and Metaclasses in Smalltalk
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Here's an implementation of what I currently use to track down the basemethod (taken from mx.Tools):
How am I supposed to use this?
I tried this:
class B:
def foo(self):
print "B.foo"
class C(B):
def foo(self):
print "C.foo"
B.foo(self)
print basemethod(self.foo) # Expect this to be B.foo
class D(C):
def foo(self):
print "D.foo"
C.foo(self)
d = D()
d.foo()
but the call to basemethod(self.foo) in C prints C.foo, not B.foo as required.
--Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] Classes and Metaclasses in Smalltalk
- Next message: [Python-Dev] Classes and Metaclasses in Smalltalk
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]