S
S
szafranji2020-09-08 21:52:17
Python
szafranji, 2020-09-08 21:52:17

Python annotations?

Hello, I'm studying the topic "annotations in Python" and wondered: how often are annotations used in real projects or does no one use it anymore?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Roman Kitaev, 2020-09-09
@szafranji

Serious projects always use it, optionally adding mypy on top. With type annotations, life becomes much easier. This radically facilitates the understanding of the code in the future, its support and, especially, teamwork. Also, annotations make it better to design the project architecture, use interfaces instead of specific implementations (in python, however, this is ABC) and use polymorphism with might and main.
And with the advent of the miracle pydantic, life has become even better. Well, fastapi built on top of it and starlette.
Those who do not use annotations have never developed anything more complicated than an online store in one person and have not supported the project for 2+ years.

D
Dr. Bacon, 2020-09-08
@bacon

Are used. There are projects where this is the basis, fastapi and pydantic

S
soremix, 2020-09-08
@SoreMix

They are little used, because usually all the information is written in the docstring. Immediately and the type of the parameter, and what it is for

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question