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()
        print("bar")


instance = C()
instance.bar()


I tried to use @staticmethod, @classmethod, but I
am getting some errors.. sometimes saying "unbound " and sometimes "given
more than 1 parameters".. can any one tell me how to do this...

Do you expect us to guess what you do? Please show the SMALLEST example and the actual error:

http://homepage1.nifty.com/algafield/sscce.html



I java it really works well.

It works really well in Python too.



--
Steven

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to