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

Резултати

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

Пребарај: #asmara

当前筛选 #asmara清除筛选
Addis Standard

@addisstandardeng · Post #22009 · 13.04.2026 г., 08:01

News: #Eritrea’s President Isaias meets #China’s Horn of Africa envoy, calls for expanded role Eritrean President #Isaias_Afwerki met with Hu Changchun, China’s Special Envoy to the Horn of Africa, on 10 April 2026 at the Denden Guest House in #Asmara. According to Information Ministry of Eritrea, President Isaias reiterated Eritrea’s readiness to strengthen its engagement with China, emphasizing the need for a more prominent Chinese role in global & regional affairs amid what he described as heightened instability. He also highlighted Africa’s natural & human resources, underscoring what he called China’s expected contribution to their development. Ambassador Hu, for his part, expressed Beijing’s readiness to deepen its strategic partnership with Eritrea and to align development efforts in support of peace and stability in the Horn of Africa, the ministry said. Eritrea’s Foreign..... https://www.facebook.com/AddisstandardEng/posts/pfbid0a26QnfAYtXCvNLrMw4DJ9cPu2Qoa9fcMnhd8HospCtDC5JThQZJdxGCxoe1iWwWMl

Addis Standard

@addisstandardeng · Post #21496 · 23.02.2026 г., 08:32

News: #Saudi deputy foreign minister meets #Ethiopian FM week after Isaias talks in Asmara Saudi Arabia’s Vice Minister of Foreign Affairs, Waleed A. M. Elkhereiji, met with Ethiopia’s Minister of Foreign Affairs, Gedion Timothewos, in Addis Abeba, a week after holding talks with #Eritrean President #Isaias Afwerki in #Asmara. According to a statement from the Ethiopian Ministry of Foreign Affairs, the two officials discussed the “strong and longstanding bilateral relations” between Ethiopia and the Kingdom of Saudi Arabia, underscoring the importance of elevating ties to “a new high.” They also exchanged views on regional peace & security issues of mutual interest. Ethiopia’s Minister of Foreign Affairs offered no additional information in the statement. The meeting comes a week after Saudi Vice Foreign Minister Waleed A. M. Elkhereiji held talks in Asmara with Eritrean President... Read more: https://addisstandard.com/saudi-deputy-foreign-minister-meets-ethiopian-fm-week-after-isaias-talks-in-asmara/

Addis Standard

@addisstandardeng · Post #21370 · 11.02.2026 г., 12:55

News: #Amhara security bureau alleges #TPLF, #Eritrea involvement in ongoing conflicts The Amhara Regional State Peace and Security Bureau has alleged that ongoing conflicts in the Amhara region and elsewhere in #Ethiopia are receiving what it described as “leadership and logistical support from #Mekelle and #Asmara,” referring to the Tigray People’s Liberation Front (TPLF) and Eritrean government. In a statement released yesterday, the bureau said the public “must understand the reality” that the fighting is not only against groups it characterized as “extremists” but also involves what it described as internal and external actors. The statement further alleged that a group seeking control over the areas of #Wolkait, #Telemt, and #Raya had assigned what it called a mission to “internal extremist forces” and was mobilizing them to advance that objective. According to the bureau, the strategy aims to create conflicts across various zones and districts to... Read more: https://addisstandard.com/?p=55148