ivankorobkov / python-inject

Python dependency injection
Apache License 2.0
672 stars 77 forks source link

Changes typing.NoReturn to None to follow python typing #25

Closed marceloavan closed 5 years ago

marceloavan commented 5 years ago

Considering the documentation, NoReturn is used just to methods that do never return, as follow:

Special type indicating functions that never return. Example::


from typing import NoReturn
   def stop() -> NoReturn:
       raise Exception('no way')

> 
>     This type is invalid in other positions, e.g., "List[NoReturn]"
>     will fail in static type checkers.
ivankorobkov commented 5 years ago

Hi! As far as I understand it's just a cosmetic issue, isn't it?

marceloavan commented 5 years ago

Hi Ivan. I think it's more than that. A developer who reads the method documentation plus its type may have a misunderstanding of using the method if it is declared as NoReturn. It may not be a common problem, but as the types are declared, I think it's best to use the type that fits most appropriately.