Does using type hints affect interpreter’s performance?
There’s no effect on performance whatsoever with or without type hints. Cpython ignore type hints similar to how comments are discarded during runtime.
Conclusion
To summarize the article, type hints:
1.Prevent us from making silly mistakes in attribute names.
2. Make code more readable.
3. Self documents the code
4. Helps in auto completion.
5. Along with linter, warns developer of potential incompatibilities.
Thanks for reading till the end! If you liked this article or are interested in topics like Automation and Python, or PHP.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
۱.از اشتباهات ساده و احمقانه جلوگیری میکند
۲.کدهای ما را خواناتر میکند
۳. خود اسناد را مستند سازی میکند
۴.برای تکمیل خودکار کمک مان میکند.
۵. همراه با لینتر، توسعه دهنده را از ناسازگاریهای احتمالی هشدار میدهد.
در مجموع سرعت انچنانی به برنامه ما اضافه نمیکند --> بلکه خوانایی و تمیزی کدها و فهمیدن انها را برای ما کمک میکند.
لینک مقاله :
https://python.plainenglish.io/you-should-start-using-python-type-hints-right-now-2b041ce39e68