trouble understanding inheritance...
Fredrik Lundh
fredrik at pythonware.com
Wed Aug 16 14:44:33 EDT 2006
KraftDiner wrote:
> This is not working the way I think it should....
> it would appear that fromfile and getName are calling the baseClass
> methods which are
> simple passes.... What have I done wrong?
>
> class baseClass:
> def __init__(self, type):
> if type == 'A':
> self = typeA()
> else:
> self = typeB()
__init__ is not a constructor, and assigning to self doesn't change the
type of the constructed object.
looks like you need to get a better tutorial.
</F>
More information about the Python-list
mailing list