add backwards compatibility comment

This commit is contained in:
Martin Teichmann 2016-07-17 13:23:59 +02:00 committed by GitHub
parent 1f9366430b
commit 0d5f991c2e
1 changed files with 14 additions and 0 deletions

View File

@ -350,6 +350,20 @@ if keyword arguments are given::
Defining both ``__init__`` and ``__new__`` continues to work fine.
About the only thing that stops working is passing the arguments of
``type.__new__`` as keyword arguments::
class MyMeta(type):
def __new__(cls, name, bases, namespace):
return super().__new__(cls, name=name, bases=bases,
dict=namespace)
class MyClass(metaclass=MyMeta):
pass
This will now raise ``TypeError``, but this is weird code, and easy
to fix even if someone used this feature.
Rejected Design Options
=======================