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

Резултати

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

Пребарај: #distances

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

@cosmomyst · Post #252 · 10.09.2025 г., 16:11

🪐 The quasar J0313–1806 is one of the most distant known objects in the universe, shining from over 13 billion light-years away. Quasars are the bright centers of young galaxies powered by supermassive black holes, and J0313–1806’s powerful light reveals it existed just 670 million years after the Big Bang, allowing astronomers to study the early universe’s first giant black holes and galaxies. ✨ #space⚡#distances⚡#quasars⚡#universe⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#cosmos 👉subscribe Universe Mysteries ​

Universe Mysteries 🪐

@cosmomyst · Post #709 · 12.03.2026 г., 22:21

🪐 Astronomers have confirmed that even the most distant light we see from galaxies like GN-z11—whose glow began its journey over 13.4 billion years ago—travels at exactly the same constant speed of 299,792 kilometers per second as light here on Earth. This unchanging speed of light lets scientists measure cosmic time and distance across the universe, meaning every photon from GN-z11 carries a record of its unimaginably long trip through space and the early history of everything we see. ✨ #speedoflight⚡#galaxies⚡#distances⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #692 · 22.02.2026 г., 12:21

🪐 The speed of light acts as the ultimate speed limit in our universe—no information or object can travel faster than 299,792 kilometers per second, not even the most powerful pulses from the Crab Pulsar in the heart of the Crab Nebula. This constant speed is what lets astronomers measure vast cosmic distances, and it’s the reason we see stars, galaxies, and even supernova explosions like SN 1987A as they were in the past, not as they are right now. ✨ #speedoflight⚡#spacetime⚡#distances⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #225 · 05.09.2025 г., 03:11

🪐 In the vacuum of space, the speed of light is an incredible 299,792 kilometers per second—so fast that a beam from the Sun takes just over eight minutes to reach Earth, even though the distance is about 150 million kilometers. When astronomers observe events like a supernova in the galaxy NGC 2525, they're actually seeing what happened years, decades, or even millions of years ago, because the light takes that long to cross vast cosmic distances. ✨ #speedoflight⚡#space⚡#distances⚡#supernova⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos 👉subscribe Universe Mysteries ​

Universe Mysteries 🪐

@cosmomyst · Post #359 · 01.10.2025 г., 20:21

🪐 The galaxy MACS0647-JD is among the most distant objects ever observed by the Hubble Space Telescope—its light started traveling toward us about 13.3 billion years ago, when the universe was less than 4% of its current age. Seeing MACS0647-JD allows scientists to peer back to the era when the very first galaxies began to form, offering a glimpse into the universe's ancient youth. ✨ #galaxies⚡#distances⚡#cosmicmysteries⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #716 · 19.03.2026 г., 22:21

🪐 RX J0911+0551 is one of the most distant gravitationally lensed quasars ever found, with its light traveling about 11 billion years to reach us. This quasar—an extremely bright object powered by a supermassive black hole—appears as several split images in the sky because a massive galaxy between us and RX J0911+0551 bends and magnifies its light, acting as a "gravitational lens" and allowing scientists to glimpse extreme distances near the edge of the visible universe. ✨ #quasars⚡#spacelensing⚡#distances⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #226 · 05.09.2025 г., 13:11

🪐 The planet Mercury orbits just 58 million kilometers from the Sun, but even this smallest orbit is immense—large enough to fit nearly 150 Earth-Moon distances end to end. In contrast, the distance from the Sun to Neptune, the most distant major planet, is about 4.5 billion kilometers, meaning a signal traveling at the speed of light takes over four hours to cross our solar system from center to edge. ✨ #distances⚡#solar⚡#Mercury⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries ​