Re: way to define static method

2007-08-22 Thread Bruno Desthuilliers
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

Re: way to define static method

2007-08-22 Thread Eric CHAO
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

Re: way to define static method

2007-08-22 Thread Marc 'BlackJack' Rintsch
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&#x

way to define static method

2007-08-22 Thread Eric CHAO
I think Python uses a very strange way to define static method in a class. Why not make it like this? class MyClass: def my_static_method(self): # self should be None as it's a static method # just ignore self I'm a newcomer so maybe it's quite naive. But I jus