Static class methods

Sven Peters svpeters at t-online.de
Mon Mar 5 01:06:06 CET 2001


Chris Armstrong wrote:

> I have trouble believing that something like this is really needed.
> Could you give a real-world example?
Factoty methods, for getting objects created earlier and no longer needed, 
yet expensive to create e.g. database connection pooling.
Sure, you can place this elsewhere(module level or other objects).
Interresting:
You CAN have class methods:
def bert:
        print "Bert"
class.method = bert
class.method()
"Bert"

... but no language support to create them as easy as instance methods

-- 
Sven Peters



More information about the Python-list mailing list