> class uhel: > > @staticmethod > def static(a): > print "trida1.static(): ", a > > def method(self): > self.static(1) > > class zemepisny_uhel(uhel): > > [EMAIL PROTECTED] > def static(a): > print "trida2.static(): ", a > > a = uhel() > a.method() > > b = zemepisny_uhel() > b.method() > > trida1.static(): 1 > Traceback (most recent call last): > File "C:\home\astrol\test.py", line 25, in ? > b.method() > File "C:\home\astrol\test.py", line 10, in method > self.static(1) > TypeError: static() takes exactly 1 argument (2 given) > Mam jednu pripominku. Jak muzete definovat methodu tridy, kde neni prvni parametr self (zemepisny_udel.static)? Muzete mi prosim ve zkratce vysvetlit, co presne hledate? Uz se v tomhle threadu trosku ztracim a docela rad bych problematice porozumel.
Pokud ma byt vysledek toto: trida1.static(): 1 trida2.static(): 1 pak vam chybi jen ten self v metode zemepisny_uhel.static() Pokud ale ocekavate toto: trida1.static(): 1 trida1.static(): 1 pak nahradte uhel.static(1) za self.static(1) v metode uhel.method() + pridejte self do methody zemepisny_uhel.static() Prosim jeste jednou o poslani mensiho popisu, co ocekavate za chovani. Diky, Leo _______________________________________________ Python mailing list [email protected] http://www.py.cz/mailman/listinfo/python
