Re: [Tutor] static methods & class methods

2012-04-20 Thread Walter Prins
Hi Surya On 20 April 2012 17:32, Surya K wrote: > I mean, say I defined foo() , bar() methods in a class myClass. So, how > can we i use foo() in bar(). I tried to use @staticmethod, @classmethod, > but I am getting some errors.. > > sometimes saying "unbound " and sometimes "given more than 1 p

Re: [Tutor] static methods & class methods

2012-04-20 Thread Alan Gauld
On 20/04/12 16:32, Surya K wrote: I java it really works well. Java: this.foo() Python: self.foo() Works almost identically in both. Of course in Java the 'this' is optional but many style guides recommend its use to make it clear where the function lives... If you really like 'this' ove

Re: [Tutor] static methods & class methods

2012-04-20 Thread Prasad, Ramit
> I have a class, and want to use a method of it in the class itself. > > How can I do it? > > I mean, say I defined foo() , bar() methods in a class myClass. So, how > can we i use foo() in bar(). I tried to use @staticmethod, @classmethod, > but I am getting some errors.. > > sometimes saying

Re: [Tutor] static methods & class methods

2012-04-20 Thread Steven D'Aprano
Surya K wrote: I have a class, and want to use a method of it in the class itself. How can I do it? I mean, say I defined foo() , bar() methods in a class myClass. So, how can we i use foo() in bar(). class C: def foo(self): print("foo") def bar(self): self.foo()

Re: [Tutor] static methods & class methods

2012-04-20 Thread Joel Goldstick
On Fri, Apr 20, 2012 at 11:32 AM, Surya K wrote: > I have a class, and want to use a method of it in the class itself. > > How can I do it? > > I mean, say I defined foo() , bar() methods in a class myClass. So, how can > we i use foo() in bar(). I tried to use @staticmethod, @classmethod, but I >

[Tutor] static methods & class methods

2012-04-20 Thread Surya K
I have a class, and want to use a method of it in the class itself. How can I do it? I mean, say I defined foo() , bar() methods in a class myClass. So, how can we i use foo() in bar(). I tried to use @staticmethod, @classmethod, but I am getting some errors.. sometimes saying "unbound " and so