[Python-Dev] PEP 318 - posting draft (original) (raw)

Guido van Rossum guido at python.org
Wed Mar 24 11:07:25 EST 2004


I think this use case is rather elegant:

def singleton(cls): return cls() class Foo [singleton]: ...

And how would this be better than

class Foo(singleton):
    ...

(with a suitable definition of singleton, which could just be 'object' AFAICT from your example)?

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list