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

Резултати

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

Пребарај: #intergalactic

当前筛选 #intergalactic清除筛选
Universe Mysteries 🪐

@cosmomyst · Post #529 · 30.11.2025 г., 12:21

🪐 The light from the Triangulum Galaxy (Messier 33), our next-nearest spiral neighbor, takes about 2.7 million years to reach Earth—meaning we see this galaxy as it was millions of years ago. Even within the Local Group of galaxies, the vast stretches of intergalactic space are so immense that a beam of light travels these cosmic distances only after crossing generations of life on our planet. ✨ #spacedistances⚡#triangulumgalaxy⚡#intergalactic⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #386 · 07.10.2025 г., 12:21

🪐 In 2024, observations with the CHIME radio telescope revealed that some fast radio bursts (FRBs) can travel through the sparse gas between galaxies—known as the intergalactic medium—without slowing down or scattering as much as expected. This suggests that the space between galaxies, like that between the Milky Way and the Triangulum Galaxy (M33), is even more empty and calm than scientists previously thought, allowing these intense millisecond bursts of radio energy to arrive at Earth almost untouched by cosmic matter. ✨ #FRB⚡#radioastronomy⚡#intergalactic⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #34 · 30.07.2025 г., 05:51

🪐 The Andromeda Galaxy, our colossal neighbor, is surrounded by an immense, nearly invisible halo of hot gas that spans more than 1.3 million light-years across. Recent observations with the Hubble Space Telescope revealed that this vast envelope is rich in metals and may be interacting with our own Milky Way’s halo, weaving an intergalactic veil between the two future-colliding giants. ✨ #Andromeda⚡#galactic⚡#halos⚡#intergalactic 👉subscribe Universe Mysteries