On Dec 15, 8:03 am, Lee Harr <[EMAIL PROTECTED]> wrote:
> I thought of several ways to add another name for
> a method in a subclass ...
>
> #alias.py
> class Foo(object):
> def nod(self):
> print "nodding"
>
> class Bar(Foo):
> def __init__(self):
> self.agree = self.nod
>
Lee Harr a écrit :
> I thought of several ways to add another name for
> a method in a subclass ...
>
>
> #alias.py
> class Foo(object):
> def nod(self):
> print "nodding"
>
> class Bar(Foo):
> def __init__(self):
> self.agree = self.nod
Will create an instance attribute
On Sat, 15 Dec 2007 13:03:33 +, Lee Harr wrote:
> I thought of several ways to add another name for a method in a subclass
...
> class Bar2(Foo):
> agree = Foo.nod
...
> I am leaning towards Bar2 since it has the least code.
Sure, why not?
Out of curiosity, what's wrong with just calli
I thought of several ways to add another name for
a method in a subclass ...
#alias.py
class Foo(object):
def nod(self):
print "nodding"
class Bar(Foo):
def __init__(self):
self.agree = self.nod
class Bar2(Foo):
agree = Foo.nod
class Bar3(Foo):
def agree(self):