Having problem with subclass

tekion tekion at gmail.com
Fri Oct 1 03:54:00 CEST 2010


All,
I have file name A.py with a class name Aclass. I have a file name
B.py with sub class of Aclass, like
import A
class Bclass(Aclass)
...rest of code
When I test it, calling B.py, I am getting:

class Bclas(Aclass):
NameError: name 'Aclass' is not defined

When I move  Bclass to A.py, it works.  Is there some restriction in
python that sub classing a class has be in the same file as the class
you're are sub classing? Thanks.



More information about the Python-list mailing list