J
John M. Gabriele
I've done some C++ and Java in the past, and have recently learned
a fair amount of Python. One thing I still really don't get though
is the difference between class methods and instance methods. I
guess I'll try to narrow it down to a few specific questions, but
any further input offered on the subject is greatly appreciated:
1. Are all of my class's methods supposed to take 'self' as their
first arg?
2. Am I then supposed to call them with MyClass.foo() or instead:
bar = MyClass()
bar.foo()
?
3. Is "bound method" a synonym for instance method?
4. Is "unbound method" a synonym for class method?
And if anyone's *really* daring:
Where do the so-called "static methods" fit into all this?
By the name of them, it sounds like the same thing as class
methods...
Much thanks,
---J
a fair amount of Python. One thing I still really don't get though
is the difference between class methods and instance methods. I
guess I'll try to narrow it down to a few specific questions, but
any further input offered on the subject is greatly appreciated:
1. Are all of my class's methods supposed to take 'self' as their
first arg?
2. Am I then supposed to call them with MyClass.foo() or instead:
bar = MyClass()
bar.foo()
?
3. Is "bound method" a synonym for instance method?
4. Is "unbound method" a synonym for class method?
And if anyone's *really* daring:
Where do the so-called "static methods" fit into all this?
By the name of them, it sounds like the same thing as class
methods...
Much thanks,
---J