Pokud nemate o existenci super ani paru, doporucuji seznamit se s tzv. new-style classes.
Napriklad tady: http://www.geocities.com/foetsch/python/new_style_classes.htm Je rozdil, jestli definujete tridu jako class Trida: --- old style nebo class Trida(object): --- new style Marek Dne 19. srpen 2008 15:42 David Michal <[EMAIL PROTECTED]> napsal(a): > Wow, ta metoda super je super. O te jsem nevedel. Pro kterou verzi > python je mozne ji pouzit? > > > class Child(Base): > > def __init__(self): > > super(Child, self).__init__() > > self.x = 1 > > > > Super muzes volat i na konci __init__ nebo kdekoli jinde, samozrejme. > > Zalezi na tom, co ve svem __init__ delas. > > > > A neplati to jenom pro __init__, ale pro vsechny metody, tj. super() > > zavola predka nejake tridy. > > _______________________________________________ > Python mailing list > [email protected] > http://www.py.cz/mailman/listinfo/python >
_______________________________________________ Python mailing list [email protected] http://www.py.cz/mailman/listinfo/python
