IT-новости про Python, которые стоит знать

Собрали в одном месте самые важные ссылки
консультируем про IT, Python

     30.06.2021       Выпуск 393 (28.06.2021 - 04.07.2021)       Статьи

How to use Python’s HTTPStatus with Django

A “magic number” is the anti-pattern of using a number directly rather than storing it in a descriptive variable name. In web code HTTP status codes are often used as magic numbers, perhaps because web developers memorize common codes such as 200 and 404. In Python, we can avoid such magic with descriptive references from the standard library’s http.HTTPStatus enum.

Let’s look at two ways to use HTTPStatus in our Django code.