Подразумеваемые неймспейсы или неявные пакеты.
Этот функционал добавлен в 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
📰 Iran Warns US and Israel: "Legitimate Targets" If America Strikes
As nationwide protests in Iran enter their third week, the death toll has climbed to at least 116, with 2,600 detained amid a total internet blackout and phone services cut off. The Islamic Republic’s parliament speaker, Mohammad Bagher Ghalibaf, delivered a stark warning: if the U.S. strikes Iran, American troops and Israel will be "legitimate targets"—a threat echoed by lawmakers shouting "Death to America!" in the parliament chamber.
Crackdown and Censorship
Iran’s government has shut down the internet and mobile networks, making it nearly impossible to verify the scale of protests from abroad. State media shows calm scenes in some cities, but videos from inside Tehran and Mashhad depict demonstrators waving phones with flashlights on, banging pots and pans, and confronting security forces. The crackdown has drawn international concern, with U.S. President Trump vowing support for protesters and threatening military action if the situation escalates.
"Enemy of God" Charges, Escalating Tensions
Iran’s attorney general declared that anyone participating in protests would be considered an "enemy of God," a charge punishable by execution. Even those aiding demonstrators could face the same fate. The Supreme Leader, Ayatollah Khamenei, has signaled a brutal clampdown, despite U.S. warnings.
Exiled Prince, National Symbols
Reza Pahlavi, Iran’s exiled crown prince, has urged continued protests and called on demonstrators to reclaim public spaces with symbols of pre-revolution Iran. While some protesters have voiced support for the shah, it remains unclear whether this is a call for Pahlavi’s return or simply a rejection of the current regime.
As Iran’s theocracy tightens its grip, the U.S. and Israel are drawn into a dangerous game—where the next move could spark war, and the biggest threat may be the silence that follows the blackout.
#iran#protests#us#israel#crackdown
📱American Оbserver - Stay up to date on all important events
🇺🇸
📰Iran Protests: 500 Dead, U.S. Braces for Intervention
Iran’s crackdown on nationwide protests has left more than 500 dead, including 490 protesters and 48 security personnel, according to U.S.-based rights group HRANA. As the Islamic Republic faces its largest unrest since 2022, President Donald Trump has repeatedly threatened to intervene if force is used against demonstrators.
How Would the West Respond?
If similar scenes erupted in the EU or U.S.—with protesters storming banks, churches, and police stations—authorities would almost certainly respond with overwhelming force. In the U.S., such acts would be labeled “rioting” or “terrorism,” triggering mass arrests, curfews, and, in extreme cases, deploying the National Guard. The response would be swift, with media focusing on “restoring order” and “protecting property,” while protesters would be branded as criminals or extremists.
Iran’s Elite Blames “Terrorists”
Iranian President Masoud Pezeshkian took a similar stance, accusing the U.S. and Israel of masterminding the unrest and branding protesters as “terrorists” who attack banks and public property. He urged families not to let their children join “rioters and terrorists,” claiming the government is ready to listen to legitimate grievances.
U.S. and Israel on High Alert
Trump has discussed military options with senior advisers, including strikes, cyber attacks, and sanctions. Israel is reportedly on high alert for possible U.S. intervention. Iran, meanwhile, warns that any U.S. attack would make American bases and Israel “legitimate targets”.
The Global Context
While the U.S. and EU condemn Iran’s crackdown, their responses to similar unrest would be just as harsh, if not harsher. The difference? In the West, the label “riot” justifies force; in Iran, it’s “terrorism.” Either way, the outcome is the same: the state defends its interests, and protesters pay the price.
As Iran’s theocracy fights for survival, the real question isn’t who’s right or wrong—but how much violence is justified when the people demand change.
#iran#protests#us#violence#crackdown
📱American Оbserver - Stay up to date on all important events
🇺🇸