On Wednesday 05 September 2007 16:59, Jason Doege wrote:
> Thanks for the good and useful information on this. Now for the
> why...
>
> I am building an API and for various reasons I have chosen Python
> to implement it. I'd like to separate the implementation from the
> interface as, for instance,
Kent Johnson wrote:
> Jason Doege wrote:
>> I am building an API and for various reasons I have chosen Python to
>> implement it. I'd like to separate the implementation from the interface
>> as, for instance, C++ does with separate .hpp and .cpp files. Apart from
>> defining a class with a bunch o
Kent Johnson wrote:
> Ricardo Aráoz wrote:
>
>> Yep. And once you've got it pls explain it too me, too lazy today to
>> pick the manual. :)
>
> I included a link to my explanation previously. I'm too lazy to try to
> do better.
>
LOL, too tired yesterday to even think straight.
Thanks for your
Jason Doege wrote:
> Thanks for the good and useful information on this. Now for the why...
>
> I am building an API and for various reasons I have chosen Python to
> implement it. I'd like to separate the implementation from the interface
> as, for instance, C++ does with separate .hpp and .cpp f
Thanks for the good and useful information on this. Now for the why...
I am building an API and for various reasons I have chosen Python to
implement it. I'd like to separate the implementation from the interface
as, for instance, C++ does with separate .hpp and .cpp files. Apart from
defining a c
Ricardo Aráoz wrote:
> Yep. And once you've got it pls explain it too me, too lazy today to
> pick the manual. :)
I included a link to my explanation previously. I'm too lazy to try to
do better.
> Any easier way?
Easier how? I don't know what could be easier to implement than a single
functi
Alan Gauld wrote:
> "Kent Johnson" <[EMAIL PROTECTED]> wrote
>
>>> Wanted to change the mfunc method but ONLY for an instance, not a
>>> class:
>> I believe the correct way to do this is to use the __get__() method
>> of
>> the function object to create a bound method and assign that to the
>> i
"Kent Johnson" <[EMAIL PROTECTED]> wrote
>> Wanted to change the mfunc method but ONLY for an instance, not a
>> class:
>
> I believe the correct way to do this is to use the __get__() method
> of
> the function object to create a bound method and assign that to the
> instance attribute:
Wow!
Ricardo Aráoz wrote:
> So lets take it a notch up.
> Wanted to change the mfunc method but ONLY for an instance, not a class:
>
MyObj = MyClass()
MyObj.mfunc(data)
> pre change behavior
MyObj.mfunc = newfunc
MyObj.mfunc(data)
> Traceback (most recent call last):
> File "", li
Alan Gauld wrote:
> "Jason Doege" <[EMAIL PROTECTED]> wrote
>
>> I'd like to change the behavior of a class' member function
>> dynamically
>> such that, once changed, all objects of the type would see the new
>> behavior.
>
> class MyClass (object) :
>> def mfunc(self, data):
>>
"Jason Doege" <[EMAIL PROTECTED]> wrote
> I'd like to change the behavior of a class' member function
> dynamically
> such that, once changed, all objects of the type would see the new
> behavior.
class MyClass (object) :
> def mfunc(self, data):
>print 'pre change behavior'
>
Hi All,
I'd like to change the behavior of a class' member function dynamically
such that, once changed, all objects of the type would see the new
behavior.
For instance:
>>> class MyClass (object) :
def mfunc(self, data):
print 'pre change behavior'
>>> aMyClassObj = MyClass()
>>
12 matches
Mail list logo