Python Forum
Type Hinting - who's using it?
Poll: How much are you using type hinting?
You do not have permission to vote in this poll.
Not at all
50.00%
3 50.00%
A little
33.33%
2 33.33%
A lot
16.67%
1 16.67%
Total 6 vote(s) 100%
* You voted for this item. [Show Results]

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Type Hinting - who's using it?
#4
Have look into it and used it some times more to test it out.
Can use it there it make sense trough the concept of gradual typing.
Code without type hints will be ignored by the static type checker.
Therefore can start adding types to where it make sense and critical components,and continue as long as it adds value to you.

Bigger companies like eg Dropbox and Instagram use this heavily think now is almost mandatory for them.
Our journey to type checking 4 million lines of Python
Instagram has made MonkeyType to add type annotations to code where is not automatically.
So can take MonkeyType Shifty for test to see what it dos.
def double(number):
    return number * 2.5

print(double(4))
print(double(5.5))
Output:
10.0 13.75
So can take integer or float as input,and output will be float.
Using MonkeyType:
E:\div_code\read
λ monkeytype apply clean
After apply:
from typing import Union

def double(number: Union[float, int]) -> float:
    return number * 2.5

print(double(4))
print(double(5.5))

Conclusion i quote Python Type Checking (Guide) it's a well written Guide bye Geir Arne Hjelle a fellow countryman.
Geir Arne Hjelle Wrote:Conclusion

Type hinting in Python is a very useful feature that you can happily live without.
Type hints don’t make you capable of writing any code you can’t write without using type hints.
Instead, using type hints makes it easier for you to reason about code, find subtle bugs, and maintain a clean architecture.
Reply


Messages In This Thread
Type Hinting - who's using it? - by micseydel - Feb-03-2020, 09:50 PM
RE: Type Hinting - who's using it? - by Larz60+ - Feb-03-2020, 10:39 PM
RE: Type Hinting - who's using it? - by metulburr - Feb-04-2020, 12:16 AM
RE: Type Hinting - who's using it? - by snippsat - Feb-04-2020, 01:37 PM
RE: Type Hinting - who's using it? - by micseydel - Feb-04-2020, 10:08 PM
RE: Type Hinting - who's using it? - by Larz60+ - Feb-04-2020, 10:39 PM
RE: Type Hinting - who's using it? - by wavic - Feb-05-2020, 11:51 AM
RE: Type Hinting - who's using it? - by DeaD_EyE - Feb-05-2020, 12:19 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020