package extension problem

Miki Tebeka miki.tebeka at gmail.com
Mon Feb 13 12:18:16 EST 2012


> B[some_hash] still returns an instance of the old class A, while I want 
an instance of the new class A. 
I don't understand this sentence. How does B[some_hash] related to A?

I've tried the below and it seems to work. Can you paste some code to help us understand more?

-- old.py --
class A:
    pass

-- new.py __
import old
class A(old.A):
    pass

-- main.py --
import new
a = new.A()
a.__class__ # Shows new.A



More information about the Python-list mailing list