[Tutor] class/type methods/functions
A.T.Hofkamp
a.t.hofkamp at tue.nl
Thu Oct 30 13:30:56 CET 2008
spir wrote:
> Q: Is there a way to write /type/ (class) functions, meaning methods not
> bound to an instance, in python?
As Bob Gailer already said, staticmethod seems to do what you want.
After reading your mail, I cannot help wondering that something crucial seems
to be missing in your class structure. (I get the impression that you are
trying to squeeze object information and object meta information together in
one class definition.)
The examples you give are however too fragmented for me, to understand the
underlying problem you are trying to solve.
Have you considered using the factory pattern? (ie make an object that
represents the type, and another one for the data) In that way you can nicely
seperate both kinds of information.
Sincerely,
Albert
More information about the Tutor
mailing list