Многие из тех кто активно работал с Python2 несколько удивлены, почему в Python3 удобная функция reload() переехала из builtin в imp а потом и в importlib?
Ну было же удобно! А теперь лишний импорт😖
Дело в том, что начиная с Python3.3 функция reload() переписана на Python вместо Cи.
Что это нам даёт?
🔸 Такой код проще поддерживать и развивать
🔸 Python код легче читать, изучать и понимать.
Сравните это ➡️ и это ➡️.
🔸 Как результат пункта 2, проще писать свои расширения импорта. Например, пользовательский импортёр с какой-либо хитрой логикой по аналогии с импортом из zip архивов.
А есть ли у этого решения недостатки? Да, они всегда есть.
🔹 Так как это не builtin функция, её следует импортнуть перед использованием
🔹 Скорость замедлилась примерно на 5%. Очевидно, что это совершенно не критично. К тому же от версии к версии логика импорта будет оптимизироваться и ускоряться.
В самом начале файла importlib/__init__.py мы видим такой импорт:
import _imp # Just the builtin component, NOT the full Python module
То есть часть функционала по прежнему написана на Си, но достаточно низкоуровневая.
#basic
A study of 1,160 men found that nose size can predict penis size. Larger noses were linked to longer penises. Penis length was also related to lower BMI. Penis circumference was linked to body weight and testicle size. Height, weight, foot size, and testosterone were measured, but nose size and BMI were key for length.
This study supports the old myth about nose and penis size.
👃📏🍌🤏
[Read more]
@googlefactss#Science#BodyFacts#MythConfirmed
The lunula is the white, crescent-shaped part at the base of your fingernail. It shows where new nail cells grow.
💅🌙
@googlefactss
#Lunula#Nails#BodyFacts
The glabella is the smooth area of skin between your eyebrows and above your nose. It helps show facial expressions like frowning.
👁️🗨️🙂
@googlefactss
#Glabella#Face#BodyFacts
The axilla is the medical term for your armpit—the area under your shoulder where your arm connects to your body. It contains lymph nodes, sweat glands, and important blood vessels and nerves.
🦴💪
@googlefactss
#Axilla#Armpit#BodyFacts
The canthus is the corner where your upper and lower eyelids meet, near your eye's edge. It helps protect your eyes and drain tears.
👁️💧
[Read more]
@googlefactss
#Canthus#Eye#BodyFacts
Double body fact today:
●The gnathion is the lowest point on the front of your chin, right in the middle. It’s often used as a reference point in anatomy and facial measurements.
●The zygion is the most lateral point of the zygomatic arch (cheekbone) on your face. It’s often used in anthropology and facial measurements to assess facial width.
😊📏
[Source picture]
@googlefactss
#Zygion#FacialAnatomy#Anthropology
#Gnathion#Chin#BodyFacts