Hello,

I wish to extend the functionality of an existing python package by creating
a new package that redefines the relevant classes of the old package. Each
new class inherits the equivalent old class and adds new methods.

In the new package there is something like the following.

import old_package as op

class A(op.A):
    ...
    add new methods
    ...

class B(op.B):
    ...
    add new methods
    ...

Some classes of the old package works as a dictionary of other classes of the same old package. Example: if class A and class B are classes of the old package,
B[some_hash] returns an instance of A.

When a program imports the new package and create instances of the new class B,
B[some_hash] still returns an instance of the old class A, while I want
an instance of the new class A.

There is a way to solve this problem without redefining in the new package all the
methods of the old package that return old classes?


Thanks in advance for any suggestion,
Fabrizio
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to