new style class

Boris Borcic bborcic at gmail.com
Fri Nov 2 07:51:24 EDT 2007


gert wrote:
[...]

>>>> Why doesn't this new style class work in python 2.5.1 ?
>>> why should it ?
>> I don't know I thought it was supported from 2.2?
> 
> oops the code is like this but doesn't work
> 
> class Test(object):
> 
>     def m1(self,v):
>         return v
> 
>     def m2(v):
>         return v
> 
> if  __name__ == '__main__':
>     gert = Test()
>     print gert.m1('1')
>     print Test.m2('2')
> 

You should put a '@staticmethod' decorator before your m2 method definition





More information about the Python-list mailing list