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

Резултати

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

Пребарај: #navaloperations

当前筛选 #navaloperations清除筛选
Crypto M - Crypto News

@CryptoM · Post #65150 · 11.04.2026 г., 12:55

🚀 U.S. Navy Ships Navigate Hormuz Strait Without Coordination with Iran On April 11, U.S. officials announced that several U.S. Navy vessels traversed the Strait of Hormuz on Saturday. According to BlockBeats, the passage was conducted without coordination with Iranian authorities. The Strait of Hormuz is a strategic waterway, and such movements often draw international attention due to the geopolitical tensions in the region. #USNavy#HormuzStrait#Iran#Geopolitics#NavalOperations#InternationalRelations#MiddleEast

Crypto M - Crypto News

@CryptoM · Post #65296 · 12.04.2026 г., 15:20

🚀 Iran Intercepts U.S. Warships Near Strait of Hormuz Iran's navy reported intercepting two U.S. warships near the Strait of Hormuz as they attempted to enter the Persian Gulf during a ceasefire. According to NS3.AI, the vessels were identified as the Frank E. Petersen and Michael Murphy. Iran alleged that the ships aimed to project an image of a successful passage and potentially influence ongoing negotiations between the U.S. and Iran. #Iran#USNavy#StraitOfHormuz#Military#NavalOperations#PersianGulf#Geopolitics#InternationalRelations

Crypto M - Crypto News

@CryptoM · Post #65096 · 11.04.2026 г., 00:45

🚀 Iran Faces Challenges in Reopening Hormuz Strait Due to Unlocated Mines Iran is encountering difficulties in fully reopening the Strait of Hormuz as it struggles to locate all the mines it previously deployed. According to Odaily, the country also lacks the necessary capabilities to effectively clear these mines. This situation poses significant challenges for Iran in ensuring the safe passage of vessels through this critical waterway. #Iran#HormuzStrait#Mines#MaritimeSafety#Shipping#NavalOperations#InternationalTrade#Geopolitics

Crypto M - Crypto News

@CryptoM · Post #65313 · 12.04.2026 г., 22:02

🚀 CENTCOM to Enforce Blockade on Iranian Maritime Traffic CENTCOM has announced a blockade on all maritime traffic entering and leaving Iranian ports, effective April 13 at 10 a.m. ET. According to NS3.AI, this directive applies to vessels of any flag or ownership within Iranian coastal waters, including ports in the Arabian Gulf and the Gulf of Oman. Ships transiting the Strait of Hormuz to or from non-Iranian ports will maintain freedom of navigation. CENTCOM has not specified the duration of the blockade and stated that further guidance will be provided. #CENTCOM#Iran#Maritime#Blockade#StraitOfHormuz#ArabianGulf#GulfOfOman#NavalOperations

Crypto M - Crypto News

@CryptoM · Post #65342 · 13.04.2026 г., 00:52

🚀 UK Declines Participation in US Strait of Hormuz Blockade Informed sources have revealed that the United Kingdom will not join the United States in a blockade operation in the Strait of Hormuz, following an announcement by U.S. President Donald Trump that the US Navy would block the waterway. According to NS3.AI, a UK government spokesperson emphasized the country's commitment to freedom of navigation and stated that the UK is collaborating with France and other partners to form a coalition aimed at safeguarding the route. #UK#US#StraitOfHormuz#Blockade#NavalOperations#FreedomOfNavigation#InternationalRelations#Coalition#MaritimeSecurity