“typing” is getting deprecated in Python

Indently
26 Aug 202407:19

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

plate

Esta sección está disponible solo para usuarios con suscripción. Por favor, mejora tu plan para acceder a esta parte.

Mejorar ahora

Mindmap

plate

Esta sección está disponible solo para usuarios con suscripción. Por favor, mejora tu plan para acceder a esta parte.

Mejorar ahora

Keywords

plate

Esta sección está disponible solo para usuarios con suscripción. Por favor, mejora tu plan para acceder a esta parte.

Mejorar ahora

Highlights

plate

Esta sección está disponible solo para usuarios con suscripción. Por favor, mejora tu plan para acceder a esta parte.

Mejorar ahora

Transcripts

plate

Esta sección está disponible solo para usuarios con suscripción. Por favor, mejora tu plan para acceder a esta parte.

Mejorar ahora
Rate This

5.0 / 5 (0 votes)

Etiquetas Relacionadas
PythonTyping ModuleDeprecationDevelopersType HintingIterableCallableCollections.ABCCode EditingDocumentationBackward Compatibility
¿Necesitas un resumen en inglés?