why is there no class (static) methods in Python ?
Alex Martelli
aleaxit at yahoo.com
Mon Jun 18 05:02:09 EDT 2001
"Richard Gruet" <rgruet at intraware.com> wrote in message
news:3B2D114E.7B39D954 at intraware.com...
> Hi all,
>
> I (and other people on the Python french mail list) wonder why there
> are no class (static) methods in Python. You cannot define a really
> unbounded (ie to an instance) method within the namespace of a class.
> It's not natural nor elegant to have to create an instance to call a
> method which is not related to a particular instance. We would like to
> be able to write things like:
>
> class C:
> def staticFoo(x): print x
>
> C.staticFoo(1)
http://aspn.activestate.com/ASPN/Python/Cookbook/Recipe/52304
Alex
More information about the Python-list
mailing list