<div dir="ltr"><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">Hi Jukka,</div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif"><br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">Thanks for submitting this PEP, I think it will be a net plus for the python language. I have been using TypedDict as a <span style="color:rgb(0,0,0);font-family:"Courier New";font-size:9pt">mypy_extensions</span> module and it's been a great help.</div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif"><br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">I found that the one thing that may be less intuitive and its design is the totality property. The fact that you need to use inheritance to compose TypedDicts that contain both required and optional keys create situations that may be a little verbose for some use cases. Perhaps an "optional" property taking a list of keys that type checkers would recognize as (no surprise) optional could be an alternative design with some merit.</div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif"><br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">Best regards,</div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif"><br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">Philippe</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 15, 2019 at 12:44 PM Jukka Lehtosalo <<a href="mailto:jlehtosalo@gmail.com">jlehtosalo@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>Hi everyone,</div><div><br></div><div>I submitted PEP 589 (TypedDict: Type Hints for Dictionaries with a Fixed Set of Keys) for discussion to typing-sig [1].</div><div><br></div><div>Here's an excerpt from the abstract of the PEP:</div><div><br></div><div>PEP 484 defines the type <tt class="gmail-m_-7693731516095658281gmail-docutils gmail-m_-7693731516095658281gmail-literal">Dict[K, V]</tt> for uniform
dictionaries, where each value has the same type, and arbitrary key
values are supported.  It doesn't properly support the common pattern
where the type of a dictionary value depends on the string value of
the key.  This PEP proposes a type constructor <tt class="gmail-m_-7693731516095658281gmail-docutils gmail-m_-7693731516095658281gmail-literal">typing.TypedDict</tt> to
support the use case where a dictionary object has a specific set of
string keys, each with a value of a specific type.</div><div><div><br></div><div>Jukka Lehtosalo</div></div><div><br></div><div>[1] <a href="https://mail.python.org/mailman3/lists/typing-sig.python.org/" target="_blank">https://mail.python.org/mailman3/lists/typing-sig.python.org/</a></div></div></div>
_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org" target="_blank">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/philgagnon1%40gmail.com" rel="noreferrer" target="_blank">https://mail.python.org/mailman/options/python-dev/philgagnon1%40gmail.com</a><br>
</blockquote></div>