Does Python have Class methods
Magnus Lie Hetland
mlh at idi.ntnu.no
Fri May 11 17:53:08 EDT 2001
More information about the Python-list mailing list
Fri May 11 17:53:08 EDT 2001
- Previous message (by thread): Simulating Class (was Re: Does Python have Class methods)
- Next message (by thread): Does Python have Class methods
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Alex Martelli" <aleaxit at yahoo.com> wrote in message news:9d9fk70gmr at news1.newsguy.com... > > Right, but that supports "static methods" a la C++ rather than "class > methods" a la Smalltalk. Another alternative for "static methods" is at > http://aspn.activestate.com/ASPN/Python/Cookbook/Recipe/52304, for > example. Thomas Heller has also put up a Cookbook recipe, at > http://aspn.activestate.com/ASPN/Python/Cookbook/Recipe/52311, > which exemplifies how to support "real" (Smalltalk-ish) class methods. > > > Alex Thought I had answered this, but it seems my message didn't make it... So I try again: What about something like this: def double(self, x): return x*2 class Math: double = double This works like a class method, doesn't it? -- Magnus Lie Hetland http://www.hetland.org "Reality is that which, when you stop believing in it, doesn't go away." -- Philip K. Dick
- Previous message (by thread): Simulating Class (was Re: Does Python have Class methods)
- Next message (by thread): Does Python have Class methods
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list