complicated class question

Fred Clift fclift at verio.net
Fri Nov 8 17:40:25 EST 2002


>
> OK, something like:
>
> ## C.py
>
> import A
> import B
>
> class new_a:
>  ....
>
> # Save the original 'a' in '_a',
> # install 'new_a' in it's place.
> A._a = A.a
> A.a = new_a
>
> b = B.b()
>
> ## b should use new_a now.
>
> Did this work?
>
> -gustavo
>


This almost works, and with a small change, it works just like I want --
thanks for the idea and the help!.


rather than

class new_a:

I do

class new_a(A.a):


This way, I can then in my new_a definition, override just one one thing I
want, and I still have the rest of methods/attributes of the class
available.

Thanks a lot!

--
Fred Clift - fclift at verio.net -- Remember: If brute
force doesn't work, you're just not using enough.





More information about the Python-list mailing list