This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author joperez
Recipients docs@python, joperez
Date 2020-08-26.16:37:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1598459858.48.0.222216937484.issue41644@roundup.psfhosted.org>
In-reply-to
Content
Class definition can have kwargs which are used by `__init_subclass__` (and `__prepare__`).
However, passing these kwargs using `type` builtin function instead of class definition syntax is not documented; kwargs are not mentioned in the function signature.
https://docs.python.org/3/library/functions.html#type

However, passing kwargs to `type` works:
```python
class Foo:
    def __init_subclass__(cls, **kwargs):
        print(kwargs)
Bar = type("Bar", (Foo,), {}, bar=None) # mypy and Pycharm complain
#> {'bar': None}
```

By the way, the possibility to pass kwargs in `type` call is not documented  in https://docs.python.org/3/reference/datamodel.html#customizing-class-creation too.
History
Date User Action Args
2020-08-26 16:37:38joperezsetrecipients: + joperez, docs@python
2020-08-26 16:37:38joperezsetmessageid: <1598459858.48.0.222216937484.issue41644@roundup.psfhosted.org>
2020-08-26 16:37:38joperezlinkissue41644 messages
2020-08-26 16:37:37joperezcreate