A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2004-March/043481.html below:

[Python-Dev] PEP 318 - posting draft

[Python-Dev] PEP 318 - posting draft [Python-Dev] PEP 318 - posting draftPhillip J. Eby pje at telecommunity.com
Wed Mar 24 16:09:45 EST 2004
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()'.


More information about the Python-Dev mailing list

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