TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #197 · 4 јан.

Подразумеваемые неймспейсы или неявные пакеты. Этот функционал добавлен в Python 3.3 Что он означает? Ранее, до 3.3 пакетами считались лишь директории, в которых есть файл __init__.py. Этот файл одновременно являлся свидетельством того, что директория это Python-пакет, и служил "телом" этого пакета. То есть местом, где можно написать код, как это делается внутри модуля. Этот код исполняется в момент импорта пакета, так что его принято называть "код инициализации пакета". Начиная с версии 3.3 Любая директория считается пакетом и Python будет пытаться использовать любую директорию для импорта. Конечно, не любую в файловой системе, а только те что находятся в sys.path. Это значит, что теперь __init__.py нужно делать только если: 🔸 вам требуется создать код инициализации пакета 🔸 нужна совместимость со старыми версиями Python На мой взгляд это немного упрощает разработку, делает её чище, но с другой стороны убивает некоторую однозначность происходящего. Например, я создал репозиторий со своей библиотекой и рядом положил код примеров или тестов. repo_name/ my_library/ __init__.py main.py examples/ exam1.py exam2.py В этом репозитории пакетом является только my_library, остальные директории это не пакеты, это просто дополнительный код в файлах. Директория examples не добавлена в sys.path, в ней нет рабочих модулей. Но если она лежит рядом с my_library, то Python вполне сможет импортнуть из неё модули, так как посчитает что examples это валидный пакет. Конечно, пример несколько надуманный. Никто не будет добавлять корень репозитория в sys.path. Но, я думаю, суть ясна. Иногда директория это просто директория а не пакет! #basic#pep

Hashtags

Резултати

Пронајдени 28 слични објави

Пребарај: #insects

当前筛选 #insects清除筛选
Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40801 · 15.03.2026 г., 15:03

The praying mantis is the only insect that can turn its head rotating it up to 180 degrees due to a flexible joint between the head and prothorax. This unique, adaptation allows them to track prey and monitor surroundings without moving their bodies. @googlefactss#insects

Hashtags

Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #39916 · 10.10.2025 г., 10:50

A tarantula hawk wasp finds and stings a tarantula then carries the paralyzed spider to its lair, where it lays a single egg on the spider before burying it alive. Once the egg hatches, the larva eats the inside of the still-living spider, being careful to avoid vital organs until last. @googlefactss#insects

Hashtags

Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40524 · 11.01.2026 г., 15:05

Dragonfly nymphs (larvae) breathe and move using their anus, drawing water in for gas exchange (breathing via internal rectal gills) and expelling it forcefully for jet propulsion to escape danger or catch prey, a remarkable adaptation for their aquatic life. @googlefactss#insects#nowyouknow

Interesting Planet 🌍

@interesting_planet_facts · Post #421 · 26.07.2025 г., 00:22

🌎 Some cicada species spend 17 years underground as nymphs before emerging in huge synchronized swarms. This odd lifecycle helps them overwhelm predators and ensures their survival. ✨ #insects⚡#evolution⚡#adaptation 👉subscribe Interesting Planet

Interesting Planet 🌍

@interesting_planet_facts · Post #1159 · 24.12.2025 г., 12:11

🌎 The orchid mantis of Southeast Asia blends in with flowers thanks to petal-shaped limbs and white, pink, or yellow coloring that matches local orchids. This insect both camouflages from predators and attracts pollinators, which it ambushes for food. ✨ #animals⚡#camouflage⚡#insects 👉subscribe Interesting Planet 👉more Channels ​

Interesting Planet 🌍

@interesting_planet_facts · Post #1246 · 22.01.2026 г., 18:11

🌎 The Indian leaf butterfly disguises itself as a dead leaf when at rest, with veins and brown patterns mimicking real foliage. When disturbed, it reveals bright blue and orange wings underneath—stunning colors that help startle predators. This butterfly is native to forests in South and Southeast Asia. ✨ #camouflage⚡#adaptation⚡#insects 👉subscribe Interesting Planet 👉more Channels ​

Interesting Planet 🌍

@interesting_planet_facts · Post #378 · 21.07.2025 г., 18:22

🌎 The mimicry leaf insect looks exactly like a real leaf, down to brown spots that resemble decay. This remarkable disguise protects it from hungry predators by blending perfectly into the forest floor. ✨ #insects⚡#camouflage⚡#adaptation 👉subscribe Interesting Planet

ПретходнаСтраница 1 од 3Следна