Eric CHAO a écrit :
> Thanks a lot.
>
> Because I found a solution about static method from
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52304
This is a largely outdated recipe (while it may be usefull if you have
to write code for an old Python version).
> And that's a little bit
Thanks a lot.
Because I found a solution about static method from
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52304
And that's a little bit difficult to understand.
# direct, naive approach -- doesn't work...:
class Class1:
def static1(name):
print "Hello",name
# ...but no
On Wed, 22 Aug 2007 20:34:21 +0100, Eric CHAO wrote:
> I think Python uses a very strange way to define static method in a
> class. Why not make it like this?
What is so strange about it?
> class MyClass:
> def my_static_method(self):
> # self should be None as it's a static method
>