Newbie question: unexpected diagnostic when subclassing
John Hunter
jdhunter at ace.bsd.uchicago.edu
Tue Jul 30 20:25:45 EDT 2002
>>>>> "Jeff" == Jeff Melvaine <jeffm52 at rivernet.com.au> writes:
Jeff> I think I must be doing something basically wrong, but
Jeff> ... ??? I'm running Python 2.1 on Windows 98. I create a
Jeff> file x.py in which I declare
Jeff> class x: ...
Jeff> I then create a file y.py in which I declare
Jeff> class y(x): ...
Jeff> When I try to create an instance of y, I get the diagnostic
Your class syntax is find. At the top of y.py did you
'from x import x'? 'import x' won't do with your syntax
In y.py you either need
from x import x
class y(x):
pass
import x
class y(x.x):
pass
JDH
More information about the Python-list
mailing list