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

Резултати

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

Пребарај: #grasslands

当前筛选 #grasslands清除筛选
Amazing Geography 🌍

@amazingeo · Post #495 · 05.12.2025 г., 12:31

🌍 The Mongolian steppes have supported nomadic herding for centuries, with grasslands shaped by grazing animals and seasonal movement. This partnership keeps both wildlife and pastures thriving naturally. ✨ #nature⚡#society⚡#grasslands⚡#geography⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

Amazing Geography 🌍

@amazingeo · Post #621 · 08.02.2026 г., 20:31

🌍 Temperate grasslands like the Eurasian steppes can experience temperature swings of over 40°C between summer and winter, creating some of the planet’s most extreme seasonal contrasts. ✨ #grasslands⚡#savanna⚡#climate⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

Amazing Geography 🌍

@amazingeo · Post #475 · 25.11.2025 г., 12:31

🌍 The Pampas grasslands in South America are so fertile they support one of the world’s largest cattle industries and can produce up to seven harvests of grass each year, fueling global food markets. ✨ #grasslands⚡#agriculture⚡#SouthAmerica⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

Amazing Geography 🌍

@amazingeo · Post #583 · 20.01.2026 г., 20:31

🌍 Africa’s Miombo savanna covers over 2.7 million square kilometers—about the size of Argentina. Its woodlands support hundreds of unique butterfly species found nowhere else on Earth. ✨ #savanna⚡#grasslands⚡#ecosystems⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

Amazing Geography 🌍

@amazingeo · Post #434 · 04.11.2025 г., 20:31

🌍 Some grassland plants grow deep roots reaching over 2 meters underground. These roots help the plants survive drought and anchor soil, making grasslands some of the most erosion-resistant landscapes. ✨ #grasslands⚡#savanna⚡#ecology⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

Amazing Geography 🌍

@amazingeo · Post #242 · 15.09.2025 г., 16:12

🌍 Grasslands cover about 40% of Earth’s land surface and are found on every continent except Antarctica. Some of the world’s richest soils, called mollisols, form in temperate grasslands. ✨ #grasslands⚡#savanna⚡#soil⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography🌍 ​

Amazing Geography 🌍

@amazingeo · Post #398 · 21.10.2025 г., 12:31

🌍 Some grassland soils are so fertile they can support crops for decades without added fertilizer. These deep, dark soils store huge amounts of carbon, helping stabilize the global climate. ✨ #grasslands⚡#soil⚡#carbon⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

Amazing Geography 🌍

@amazingeo · Post #704 · 30.04.2026 г., 20:31

🌍 Argentina’s Pampas are vast temperate grasslands that grow some of the world’s richest soils. These grasslands support massive cattle herds and store huge amounts of carbon underground. ✨ #grasslands⚡#pampas⚡#carbon⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​