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

Резултати

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

Пребарај: #tarantulanebula

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

@cosmomyst · Post #32 · 30.07.2025 г., 04:51

🪐 The Tarantula Nebula in the Large Magellanic Cloud is the most active star-forming region in the Local Group of galaxies, producing some of the most massive stars ever observed. Inside this cosmic web, the star R136a1 blazes with a mass over 250 times that of the Sun, pushing the boundaries of how big stars can grow before they collapse. ✨ #TarantulaNebula⚡#starformation⚡#R136a1 👉subscribe Universe Mysteries

Universe Mysteries 🪐

@cosmomyst · Post #493 · 12.11.2025 г., 12:21

🪐 The pulsar PSR J0537−6910, spinning an incredible 62 times per second, sits in the Tarantula Nebula of the Large Magellanic Cloud and holds the record for the fastest known "glitches." Glitches are sudden jumps in a pulsar’s rotation speed—caused by internal adjustments in these ultra-dense, spinning neutron stars—and PSR J0537−6910’s frequent glitches help scientists unlock secrets about the strange matter inside these cosmic lighthouses. ✨ #pulsars⚡#neutronstars⚡#tarantulanebula⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #729 · 01.04.2026 г., 22:21

🪐 The rapidly spinning star VFTS 102, found in the Tarantula Nebula of the Large Magellanic Cloud, is one of the fastest rotating stars ever observed—spinning at over 2 million kilometers per hour. This extreme speed stretches the star into an oblate shape and may be the result of a dramatic past, possibly caused by a close encounter or collision with another star. ✨ #unusualstars⚡#tarantulanebula⚡#rotation⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #431 · 16.10.2025 г., 12:21

🪐 The star VFTS 352, located in the Tarantula Nebula about 160,000 light-years away, is actually two massive stars orbiting each other so closely that their outer layers touch—creating a rare "overcontact binary." This unusual system is on the verge of merging, and both stars are so hot and bright that their shared atmosphere fuses them together, making VFTS 352 one of the most extreme examples of stellar partnership ever found. ✨ #unusualstars⚡#binaries⚡#TarantulaNebula⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #247 · 09.09.2025 г., 16:11

🪐 In the Tarantula Nebula of the Large Magellanic Cloud, light from young, massive stars races outward at the universal speed limit—299,792 kilometers per second—helping illuminate vast clouds of gas across 1,000 light-years of space. Because nothing can travel faster than this speed in a vacuum, the glow we see from such stellar nurseries is always an echo from the past, showing us cosmic events exactly as they unfolded years, decades, or even millennia ago. ✨ #speedoflight⚡#tarantulanebula⚡#largemagellaniccloud⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries ​

Universe Mysteries 🪐

@cosmomyst · Post #554 · 12.12.2025 г., 22:21

🪐 The star R136a1, found in the Tarantula Nebula of the Large Magellanic Cloud, is considered the most massive known star, weighing in at about 215 times the mass of our Sun. Unlike ordinary stars, R136a1 is so hot and bright that it blasts vast amounts of its own material into space, shortening its lifespan to just a few million years—an incredibly brief existence for such a cosmic giant. ✨ #unusualstars⚡#tarantulanebula⚡#stellarphysics⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​