Подразумеваемые неймспейсы или неявные пакеты.
Этот функционал добавлен в 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
@RusEmbMalta:
❗Appeal of the State Duma to the United Nations, international parliamentary organizations, world parliaments in connection with the heavy toll of children’s deaths and current humanitarian situation in the Israeli–#Palestinian conflict zone
🇺🇸🇮🇱🇵🇸Ben is finally waking up to the strategic intent behind October 7.
On October 6 no one was seriously talking about a #Palestinian State.
Since October 7, everyone is.
All Hamas had to do was provide #Israel the opportunity to show the world the true face of its genocidal existence.
@MostMoralArmy
@RusEmbMalta: 📄Excerpts from the briefing by Foreign Ministry Spokeswoman Maria Zakharova, Moscow, November 15, 2023
🔹Update on #Palestinian-Israeli conflict
🔹#Ukraine crisis
🇮🇱🇵🇸Horrific scenes emerging from Al-Shati refugee camp in northern #Gaza Strip shows the bodies of #Palestinian civilians slaughtered by an #Israeli occupation bombing.
@MostMoralArmy
#Palestinian Civil Defence is currently recovering remains of #Gazan martyrs which they couldn’t previously reach. Many of these bodies have decomposed.
Gaza’s Civil Defence Spokesperson Mahmoud Basal said that the number of martyrs whose bodies evaporated reached 2848 martyrs.
#Israel’s use of internationally forbidden arms stands behind this phenomenon.
The #Palestinian Media Center said that these weapons, which haven’t been identified, melt and evaporate bodies due to the extreme heat produced by these weapons.
🇮🇱🇵🇸BREAKING: #Israeli occupation forces execute an elderly #Palestinian woman and her daughter while fleeing from Road 8 in #Gaza's Sabra neighborhood.
The two were directly shot by snipers positioned on rooftops, according to eyewitnesses.
@MostMoralArmy
🇺🇸#USA#Texas
The raising of the #Palestinian#flag in a live broadcast of the University of #Texas graduation ceremony, was accompanied by applause from the audience.
#Commentary: #Ethiopia’s Policy Realignment: From #Pan_African Beacon to Client State
On 31 March 2026, the UN Human Rights Council adopted a resolution condemning #Israel’s actions in the occupied #Palestinian territories and the Syrian Golan Heights. Thirty-one countries supported it; Ethiopia was among only three in opposition. Sidoc Haytu describes the move as “a profound betrayal of the Pan-Africanist and anti-colonial principles that once defined the Ethiopian state.”
While officials frame the vote as pragmatic, he argues it serves elite interests, noting “the calculation was not performed on behalf of the 120 million Ethiopians.”
Contrasting Ethiopia’s past stance, he claims, “When Ethiopia votes at the #UN… it is voting as a client of…Tel Aviv,” urging a reversal: “Ethiopia will not stand with colonizers.”
https://addisstandard.com/?p=56716
#EU member states #Ireland, #Spain and #Norway announce official recognition of #Palestinian#Statehood
The three countries are the only European countries, thus far, who have officially recognised the State of Palestine.
#Israel was founded by #Zionist#terrorists.
Keep that in mind next time you hear Zionists claim that recognising #Palestinian#Statehood is "rewarding #terrorism"