Alexandru Mosoi a écrit :
(snip)
i somehow fixed the problem using:
def __getattr__(self, attr):
return
functools.partial(Base.__metaclass__.__getattr__(self.__class__,
attr), self)
however this looks ugly enough to look for another solution. i still
have one more question: why do I h
On Sep 5, 1:13 pm, Peter Otten <[EMAIL PROTECTED]> wrote:
> Alexandru Mosoi wrote:
> > On Sep 5, 11:47 am, Peter Otten <[EMAIL PROTECTED]> wrote:
> >> Alexandru Moșoi wrote:
> >> > i'm facing the following problem:
>
> >> > class Base(object):
> >> > def __getattr__(self, attr): return lambda x: a
On Sep 5, 11:46 am, Alexandru Mosoi <[EMAIL PROTECTED]> wrote:
> I have another small problem. now,
> d.third('blah') doesn't work because instance d doesn't have 'third'
> attribute. I was expecting derived class to inherit the metaclass as
> well, but it didn't.
Yep, it is explained here:
http
Alexandru Mosoi wrote:
> On Sep 5, 11:47 am, Peter Otten <[EMAIL PROTECTED]> wrote:
>> Alexandru Moșoi wrote:
>> > i'm facing the following problem:
>>
>> > class Base(object):
>> > def __getattr__(self, attr): return lambda x: attr + '_' + x
>>
>> > def dec(callable):
>> > return lambda *args: '
On Sep 5, 11:47 am, Peter Otten <[EMAIL PROTECTED]> wrote:
> Alexandru Moșoi wrote:
> > i'm facing the following problem:
>
> > class Base(object):
> > def __getattr__(self, attr): return lambda x: attr + '_' + x
>
> > def dec(callable):
> > return lambda *args: 'dec_' + callable(*args)
>
> > c
Alexandru Mos,oi wrote:
i'm facing the following problem:
class Base(object):
def __getattr__(self, attr): return lambda x: attr + '_' + x
def dec(callable):
return lambda *args: 'dec_' + callable(*args)
class Derived(Base):
what_so_ever = dec(Base.what_so_ever) # wrong, base doesn't h
Alexandru Moșoi wrote:
> i'm facing the following problem:
>
> class Base(object):
> def __getattr__(self, attr): return lambda x: attr + '_' + x
>
> def dec(callable):
> return lambda *args: 'dec_' + callable(*args)
>
> class Derived(Base):
>what_so_ever = dec(Base.what_so_ever) # wron