[Python-ideas] An even simpler customization of class creation

Ethan Furman ethan at stoneleaf.us
Tue Mar 3 18:28:05 CET 2015


On 03/02/2015 02:57 AM, Martin Teichmann wrote:
>     class Soliton(type):
>        def __new__(cls, name, bases, ns):
>            self = super().__new__(name, bases, ns)
>            return self()
> 
>     class A(metaclass=Soliton):
>         def f(self):
>             print(__class__)

This should be `self.__class__`, yes?

--
~Ethan~

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150303/92ccf739/attachment.sig>


More information about the Python-ideas mailing list