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 слични објави

Пребарај: #strange

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

@cosmomyst · Post #463 · 28.10.2025 г., 22:21

🪐 In the spiral galaxy NGC 3310, astronomers have observed a rare "gamma-ray burst afterglow," the fading embers following one of the universe’s brightest explosions. This lingering glow, seen in visible light and X-rays, lets scientists track how shockwaves from the original burst plow through space, revealing clues about the powerful forces unleashed when massive stars die. ✨ #gamma-ray-bursts ⚡#strange-cosmic-phenomena ⚡#galaxies⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

"Nunca habíamos visto nada igual..." Algo aterrador está sucediendo en Estados Unidos (2025) Únase a nosotros: https://anon.news 🔘En este video, el mundo quedó atónito ante la repentina aparición de un elegante monolito metálico en los remotos desiertos de Utah. Alto y silencioso, el objeto guardaba un asombroso parecido con los monolitos de 2001: Odisea del Espacio, y luego, con la misma incógnita, desapareció. Desde entonces, han aparecido docenas de estructuras similares en lugares de todo el mundo, desde las montañas nevadas de Rumania hasta las playas de California, las selvas de Colombia y los tejados de las ciudades europeas. ¿Son instalaciones artísticas, engaños elaborados o algo más enigmático? Cada monolito parece surgir sin previo aviso, a menudo en lugares de difícil acceso, y sin que nadie se atribuya la responsabilidad. Algunos son espejados y minimalistas; otros están grabados con símbolos crípticos. El fenómeno ha desatado la intriga mundial, generando teorías de conspiración, videos virales y un auge en el debate especulativo sobre la vida extraterrestre, las sociedades secretas y la conciencia colectiva. #unexplained#strange#phenomena @EndTimesProductions@Jaymez

Universe Mysteries 🪐

@cosmomyst · Post #564 · 17.12.2025 г., 22:21

🪐 One of the most mysterious cosmic events are gamma-ray bursts, or GRBs—brief, intense flashes of high-energy light detected from distant galaxies, like the spiral galaxy NGC 2770. In 2008, NGC 2770 hosted the rare GRB 080319B, which was so bright that, for about 30 seconds, it was visible to the naked eye from Earth despite being 7.5 billion light-years away, making it the most distant object ever seen without a telescope. ✨ #gamma-ray-bursts ⚡#strange-phenomena ⚡#NGC2770⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #507 · 19.11.2025 г., 12:21

🪐 In the star-forming region W51, astronomers have found “masers”—natural lasers made of microwaves—blasting out intense, focused beams from clouds of water and methanol molecules. These cosmic masers shine thousands of times brighter than any similar emission in our solar system and act like celestial signposts, marking areas where massive new stars are being born within dense, hidden clouds of gas. ✨ #strange⚡#phenomena⚡#maser⚡#starbirth⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​