add backwards compatibility comment
This commit is contained in:
parent
1f9366430b
commit
0d5f991c2e
14
pep-0487.txt
14
pep-0487.txt
|
@ -350,6 +350,20 @@ if keyword arguments are given::
|
||||||
|
|
||||||
Defining both ``__init__`` and ``__new__`` continues to work fine.
|
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
|
Rejected Design Options
|
||||||
=======================
|
=======================
|
||||||
|
|
Loading…
Reference in New Issue