11
woops
7y

Been wondering lately. Do Python devs use type hinting? Shall i start implementing it?

I find it this way, a bit more clear about what the method is doing

Comments
  • 4
    Yeah, it's great practice to implement it as it will obviously help you and others understand your code. :)

    Also it helps your IDE to give you the right suggestions for auto-completion.
  • 1
    Yess, type hinting in Python 3 is such a great feature, and using in your code only makes it more readable and it helps you as the coder to know what the function you're calling expects and what it returns.
  • 2
    Personally I don't allow any code to be merged in that doesn't pass `mypy --strict`
  • 2
    Well looking through opinions i saw people go against it since it disables the python philosophy and looks more static type language
  • 3
    @woodworks I didn't know about that command, I'm surely gonna add it to my CI/CD process.
  • 0
    Ain't nobody got time for that!
  • 2
    Regardless of what the plebs claim, strong typing in a language is absolutely important
  • 0
    var is a dirty word
  • 0
    Personally I don't use type hints mostly because I don't find them necessary. In terms of readability, I find the variable and function name to usually describe the intention of a function of argument. In terms of performance, type hints don't improve performance since python does not perform any optimizations based on types.
Add Comment