Thursday, 16 May 2019

From variable name to type hint

Is there a way to define a type hint via the variable name?

Example:

Everytime I name a variable response in my code, I want it to have a type hint to django.http.HttpResponse.

My use case is type hinting for IDEs like PyCharm. Up to now I have no use case to evaluate this at run-time.

I would like to have general (as opposed to pycharm specific) solution.

I want to avoid doing manual and explicit type hinting over and over again.

Please tell me why you down-vote this question. I am curious and willing to learn.



from From variable name to type hint

No comments:

Post a Comment