![]() |
Available news archives:
comp.lang.tcl
-
comp.lang.python
-
comp.security.firewalls
-
sci.crypt -
comp.lang.php -
comp.lang.javascript
|
|
comp.lang.python archiveRe: "Aliasing" an object's __str__ to a different method
From: Scott David Daniels <Scott.Daniels@Acm.Org>
Date: Sat Jul 23 2005 - 14:18:50 CEST
Jeffrey E. Forcier wrote:
Here is one more standard way to do this:
class MyClass(object):
def setEdit(self):
def setView(self):
class MyEditClass(MyClass):
class MyViewClass(MyClass):
Be a little careful about the structure of the subclasses (MyViewClass
Note: for this example, you could also define the methods like:
class MyEditClass(MyClass):
When to use super rather than direct access to the superclass is an
--Scott David Daniels
|