At 09:41 PM 3/24/04 +0100, Alex Martelli wrote: >Perhaps something like...: > >class metaSingleton(type): > def __new__(cls, classname, classbases, classdict): > result = type.__new__(cls, classname, classbases, classdict) > if classbases: > return result() > else: > return result By the way, there's a bug in the above implementation: it can't be safely mixed with other metaclasses, because it calls 'type' directly instead of using 'super()'.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4