dshin
dshin

Reputation: 2398

PyCharm: option to warn user on typing mismatches

I would like PyCharm to warn me on the following python3 code:

def foo() -> str:
    return 'abc'

x: int = foo()  # I want to be warned here

Is there an option I can enable to get this warning?

The motivation here is that I have functions whose return-types are not as easily deducible at first glance like in this example. I want to declare what I think the types of my variables should be, for readability, and I want PyCharm to deduce whether what I think is correct.

Upvotes: 3

Views: 142

Answers (1)

dshin
dshin

Reputation: 2398

Turns out this is an open issue in PyCharm (PY-24832).

Upvotes: 3

Related Questions