New submission from Serhiy Storchaka <storchaka+cpyt...@gmail.com>:

typing.TypedDict is used in two ways.

1. It is a callable which produces a new pseudo-subtype of dict.
2. It can also be used as a base in the class statement for creating a new 
pseudo-subtype of dict.

In both cases it is not a real class. You cannot create an instance of 
TypedDict or its "subclass". isinstance() and issubclass() do not work with it. 
Instantiating it "subclass" always returns a dict. But it is implemented as a 
class, and help() shows methods and data descriptors for it, which are useless.

The proposed PR implements TypedDict as a function. It adds the __mro_entries__ 
method that allows to use it as a base in the class statement.

----------
components: Library (Lib)
messages: 365786
nosy: gvanrossum, levkivskyi, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Refactor typing.TypedDict
type: enhancement
versions: Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40187>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to