Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

use typing.Dict or dict in the Python

In the Python, dict and typing.Dict, I am seeing some information to say typing.Dict "Deprecated since version 3.9"

I am confused what I should choose dict or typing.Dict since Python 3.9?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You should use dict.
typing.Dict was created for allowing one to express the expected typing information in dictionaries before an update in the syntax of built-in classes itself (such as dict, list, set) would allow this to be expressed directly with the built-in classes.

The cost to remove the added classes in typing module is simply not worth doing in short-term, as it would render a lot of perfectly good Python code deprecated – but this should be expected to happen in a 10 year or so time-frame.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading