“typing” is getting deprecated in Python
Summary
TLDRIn this video, the creator expresses frustration over the deprecation of types in Python's 'typing' module since version 3.9, which was not well communicated. The video demonstrates the use of 'typing.Iterable' and 'typing.Callable', which are now recommended to be replaced with 'collections.abc' equivalents. The speaker criticizes the lack of clear deprecation warnings and the implicit handling of this change, which they only discovered in Python 3.12, and calls for more transparency in such updates.
Takeaways
- 😕 The video discusses the deprecation of certain types in the `typing` module since Python 3.9.
- 👨💻 The presenter expresses frustration over the lack of clear communication regarding these deprecations.
- 🔍 The `typing.Iterable` and `typing.Callable` types are deprecated and should be replaced with `collections.abc.Iterable` and `collections.abc.Callable`.
- 📚 The presenter found out about the deprecations only recently, despite using Python 3.2 daily and keeping up with documentation.
- 💻 The video demonstrates how to use the deprecated types in a function example, which still works without warnings.
- 🚫 The deprecation is not flagged by tools like `mypy` or PyCharm, which the presenter finds concerning.
- 📝 The change is intended to minimize the runtime impact of the `typing` module, but the presenter questions the lack of deprecation warnings.
- 🔄 The deprecated types are simply aliases to the `collections.abc` module, which should be used instead.
- 🤔 The presenter is unsure why the change is being handled implicitly and wishes for clearer communication from Python developers.
- 🗣️ The video ends with a call for feedback from viewers on their thoughts about the handling of these deprecations.
Q & A
What is the main topic of the video?
-The main topic of the video is the deprecation of certain types in the 'typing' module in Python since version 3.9.
Why is the presenter upset in the video?
-The presenter is upset because they found out about the deprecation of types in the 'typing' module only recently, despite using Python 3.2 daily, and they feel that the way this change was handled was sneaky and not well communicated.
What is the alternative to 'typing.Iterable' after its deprecation?
-After the deprecation of 'typing.Iterable', the alternative is to use 'collections.ABC.Iterable' as recommended in the Python documentation.
What does the presenter demonstrate with the 'say_hello' function?
-The presenter demonstrates that the 'say_hello' function, which takes an iterable of names, works correctly with the deprecated 'typing.Iterable' type, but should instead use 'collections.ABC.Iterable'.
What is the purpose of the 'repeat' function shown in the video?
-The 'repeat' function is used to execute another function a specified number of times, and it uses the deprecated 'typing.Callable' type, which should be replaced with 'collections.ABC.Callable'.
What is the issue with the deprecation process as described by the presenter?
-The issue is that the deprecation of types in the 'typing' module is not well communicated, and the presenter only found out about it after several Python versions had been released.
Why did the Python developers deprecate certain types from the 'typing' module?
-The Python developers deprecated certain types to minimize the runtime impact of typing and to streamline the type annotations by directing users to use 'collections.ABC' instead.
How does the presenter feel about the lack of deprecation warnings for the 'typing' module types?
-The presenter is confused and frustrated by the lack of deprecation warnings, as they believe it should have been communicated more clearly to avoid confusion among developers.
What is the presenter's opinion on the future of deprecated types in the 'typing' module?
-The presenter wishes for more concrete information about whether the deprecated types will be removed from the 'typing' module in the future or not.
What does the presenter encourage viewers to do after watching the video?
-The presenter encourages viewers to share their thoughts on the deprecation of types in the 'typing' module and whether they were aware of the change or not in the comment section.
Outlines
このセクションは有料ユーザー限定です。 アクセスするには、アップグレードをお願いします。
今すぐアップグレードMindmap
このセクションは有料ユーザー限定です。 アクセスするには、アップグレードをお願いします。
今すぐアップグレードKeywords
このセクションは有料ユーザー限定です。 アクセスするには、アップグレードをお願いします。
今すぐアップグレードHighlights
このセクションは有料ユーザー限定です。 アクセスするには、アップグレードをお願いします。
今すぐアップグレードTranscripts
このセクションは有料ユーザー限定です。 アクセスするには、アップグレードをお願いします。
今すぐアップグレード関連動画をさらに表示
Some New Features in Python 3.11
Python Bytecode: An Introductory Tutorial
Pydantic Tutorial • Solving Python's Biggest Problem
Piracy is COMPLETELY justified: Louis tries NetFlix & remembers why
'I'm Tired Of This': Ralph Norman Admonishes Jerry Nadler During Tense Exchange At Hearing
The Biggest Problem With ChatGPT | Tsoding
5.0 / 5 (0 votes)