class-call a function in a function -problem
wierus
wierus at pocztowy.net
Tue Aug 16 12:46:30 EDT 2005
Hello, i have a problem. I write my first class in python so i'm not a
experience user. I want to call a function in another function, i tried to
do it in many ways, but i always failed:(
I supposed it's sth very simple but i can't figure what it is:
==================================
class ludzik:
x=1
y=2
l=0
def l(self):
ludzik.l=ludzik.x+ludzik.y
print ludzik.l
def ala(self):
print ludzik.x
print ludzik.y
ludzik.l()
z=ludzik()
z.ala()
====================================
k.py
1
2
Traceback (most recent call last):
File "k.py", line 17, in ?
z.ala()
File "k.py", line 14, in ala
ludzik.l()
TypeError: unbound method l() must be called with ludzik instance as
first argument (got nothing instead)
i would be gratefull for resolving this problem for me....
More information about the Python-list
mailing list