class factory example needed (long)

Steven Bethard steven.bethard at
Tue Mar 1 18:48:20 CET 2005

Gary Ruben wrote:
> OK, I've managed to get this to work with Rainer's method, but I 
> realised it is not the best way to do it, since the methods are being 
> added by the constructor, i.e. they are instance methods. This means 
> that every time a foo object is created, a whole lot of code is being 
> run. It would be better to do the same thing with class 'static' 
> methods, if this is possible, so that the methods are created just once.
> Is this possible?

See my comment on the recipe at:


More information about the Python-list mailing list