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 esoma
Recipients esoma
Date 2021-01-06.15:21:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1609946481.51.0.225785046936.issue42840@roundup.psfhosted.org>
In-reply-to
Content
The documentation (https://docs.python.org/3/library/functions.html#type) shows type's signature as:

class type(object)
class type(name, bases, dict)


But the "actual" 2nd signature in CPython 3.6+ is:

class type(name, bases, dict, **kwargs)


**kwargs here gets passed to __init_subclass__ in the same way that keywords in a class statement do so that:

type("Bar", (Foo,), {}, spam='ham')

is equivalent to

class Bar(Foo, spam='ham'): pass


It's not clear to me whether this is behavior to rely on. I started using this intuitively, but found that my type checker reasonably complained.

Looking through the commit that implemented PEP 487 (d78448e9), it seems this may have been incidental. Additionally I haven't found mention of this in PEP 487 or the documentation and I can't seem to find any tests for it.
History
Date User Action Args
2021-01-06 15:21:21esomasetrecipients: + esoma
2021-01-06 15:21:21esomasetmessageid: <1609946481.51.0.225785046936.issue42840@roundup.psfhosted.org>
2021-01-06 15:21:21esomalinkissue42840 messages
2021-01-06 15:21:21esomacreate