Re: class-call a function in a function -problem

2005-08-16 Thread Bengt Richter
On Tue, 16 Aug 2005 18:46:30 +0200, "wierus" <[EMAIL PROTECTED]> wrote: >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 b

Re: class-call a function in a function -problem

2005-08-16 Thread Elmo Mäntynen
On Tue, 16 Aug 2005 18:45:51 +0200, wierus wrote: > 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 figu

Re: class-call a function in a function -problem

2005-08-16 Thread Steven Bethard
Larry Bates wrote: > def __init__(self, x=1, y=2) [snip] > self.x=x > self.y=y > self.a=0 > return > > def l(self): [snip] > self.a=self.x+self.y > print "In ludzik.l a=',self.a > return > > def ala(self): [snip] > self.l

Re: class-call a function in a function -problem

2005-08-16 Thread Steven Bethard
wierus wrote: > 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() Methods defined in a class expect an instance of that class as the first argument. When you write: l

Re: class-call a function in a function -problem

2005-08-16 Thread Larry Bates
Try something like: class ludzik: # # Define an __init__ method that gets called when # you instantiate the class. Notice also that I've # allowed you to set x, and y parameters if you like. # If you don't pass them they default to 1 and 2 as # in your example. #

class-call a function in a function -problem

2005-08-16 Thread wierus
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 lud

class-call a function in a function -problem

2005-08-16 Thread wierus
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