Class constructor throwing attribute error Python -
here programme structure:
class parent(object): def __init__(self): pass def __post_init_stuff(self): #post initialization stuff class child(parent): def __init__(self): #dostuff self.__post_init_stuff() def otherfunc(classname, args): classname(args) otherfunc(child) the problem i'm having when otherstuff(child) executes, error:
attributeerror: 'child' object has no attribute '_child__post_init_stuff'
any advice?
names start __ in python protected in c++. name 1 underscore instead or access self._parent__post_init_func, since mangled name within scope. recommend first thing, since ugly , hacky.
python
No comments:
Post a Comment