class Trida: def __init__(self, var=100): self.var = var def program(self): print self.var
T = Trida(var=500) T.program() > 500 --- In Perl you shoot yourself in the foot, but nobody can understand how you did it. Six months later, neither can you. | print 'aknerats'[::-1] 2015-03-25 16:29 GMT+01:00 "Ing. Vladislav Ludík" <vl...@ludik.cz>: > Zdravím všechny, > > prosím o radu, jak změnit hodnotu v modulu: > > class Trida: > def __init__(self): > self.var = 100 > > def program(self): > print self.var > > Naimportuju modul a zavolám: > > T = Trida() > T.program() > > vytiskne 100 > > Jak nastavím hodnotu self.var ? > > Děkuji Vlada > _______________________________________________ > Python mailing list > python@py.cz > http://www.py.cz/mailman/listinfo/python > > Visit: http://www.py.cz _______________________________________________ Python mailing list python@py.cz http://www.py.cz/mailman/listinfo/python Visit: http://www.py.cz