3 ms·
You're right, my phrasing was inaccurate. The intent was: Python does not perform type checking based on annotations (e.g. Protocols as discussed in the articl
by zbentley 5y ago
You're right, my phrasing was inaccurate.
The intent was: Python does not perform type checking based on annotations (e.g. Protocols as discussed in the article) when it starts.
Unfortunately PyCharm's analyzer is pretty fundamentally oriented towards failing open, rather than closed.
For decorators, PyCharm often infers whether or not a decorator changes a signature. However, it does this inconsistently (and it may be backed by a specific list of supported decorators by name/module, I'm not sure). When it can't tell what a decorator does, it doesn't try to validate calls to decorated functions, which is kind of a bummer. What I'd really like is a way to tell the IDE that unrecognized/unparseable decorators should be assumed not to emit functions with a different signature; that would be wrong sometimes, but useful in what is for me the most common case.