[PATCH 05 of 23 yams] [mypy] type __init__.py and add types.py

Nicolas Chauvat nicolas.chauvat at logilab.fr
Wed Feb 26 09:32:23 CET 2020


Hi Laurent,

On Tue, Feb 25, 2020 at 11:27:44PM +0100, Laurent Peuch wrote:

> > Also, you can take a look at TypedDict which seems to be appropriate to type
> > this kind of values:
> > https://mypy.readthedocs.io/en/latest/more_types.html#id3
> > (this is only available since python3.8 but there is a backport in the
> > typing-extensions package).
> 
> So I've actually explored a bit this option before realising that it
> won't work here :/ Why? Because, as quote from the documentation:
> 
> > Mypy will also reject a runtime-computed expression as a key, as it
> > can’t verify that it’s a valid key. You can only use string literals
> > as TypedDict keys.

Would using https://pyre-check.org/ remove that limitation ?

I suppose it won't, but did you try pyre anyway to compare its results with mypy ?

-- 
Nicolas Chauvat

logilab.fr - services en informatique scientifique et gestion de connaissances  



More information about the cubicweb-devel mailing list