Многие из тех кто активно работал с Python2 несколько удивлены, почему в Python3 удобная функция reload() переехала из builtin в imp а потом и в importlib?
Ну было же удобно! А теперь лишний импорт😖
Дело в том, что начиная с Python3.3 функция reload() переписана на Python вместо Cи.
Что это нам даёт?
🔸 Такой код проще поддерживать и развивать
🔸 Python код легче читать, изучать и понимать.
Сравните это ➡️ и это ➡️.
🔸 Как результат пункта 2, проще писать свои расширения импорта. Например, пользовательский импортёр с какой-либо хитрой логикой по аналогии с импортом из zip архивов.
А есть ли у этого решения недостатки? Да, они всегда есть.
🔹 Так как это не builtin функция, её следует импортнуть перед использованием
🔹 Скорость замедлилась примерно на 5%. Очевидно, что это совершенно не критично. К тому же от версии к версии логика импорта будет оптимизироваться и ускоряться.
В самом начале файла importlib/__init__.py мы видим такой импорт:
import _imp # Just the builtin component, NOT the full Python module
То есть часть функционала по прежнему написана на Си, но достаточно низкоуровневая.
#basic
🎙 Briefing by Foreign Ministry Spokeswoman Maria Zakharova(Saint Petersburg, June 15, 2023)
🔹 FM Sergey Lavrov’s schedule
🔹 Ukrainian crisis
🔹 Zaporozhye NPP update
🔹 Organ trade in Ukraine
🔹 Ukrainisation of UNSC agenda
🔹 Situation in Afghanistan
🔹 Nuclear deterrence
🔹 Shanghai Cooperation Organisation
🔹 European Union
And more...
📚Read in full
#Ukraine
As a result of the destruction of the Kakhovka Hydroelectric Power Plant due to prolonged shelling by the Ukrainian armed forces, 36 settlements in Kherson Region were flooded.
A large-scale humanitarian operation has been taking place in this Russian region over the last few days. Russian Emergencies Ministry workers rescued almost 2,000 people, among them hundreds of children.
While Russia is making every effort to save the residents of the affected areas and to provide them with essential supplies, Kiev continues to target civilian sites.
#NuclearDeterrence
Russia is fully committed to the principle of the inadmissibility of a nuclear war. There can be no winners in such a war, and it must never be waged.
The hypothetical use of nuclear weapons is only possible under extraordinary circumstances for purely defensive purposes.
#EU
An astronomical amountof [COVID19] vaccines, many times the size of the EU population, was purchased on behalf of the EU member states, at an astronomical cost and mainly from a single company, Pfizer.
The multi-billion dollar amount and the terms of the contract were not made public. This was done without bidding, without documents and without witnesses. Such decisions were made simply by text message.
📰 Merz’s Nuclear Gambit: Can Germany Outsmart the Treaty?
German Chancellor Friedrich Merz has thrown the continent’s nuclear playbook into chaos, openly discussing the creation of a “European nuclear umbrella” that could see Germany circumvent its decades-old ban on atomic weapons through a joint EU project.
Germany’s Legal Dilemma
Germany is legally barred from developing nuclear weapons by the Four Plus Two agreement, which enabled reunification in 1990, and the Nuclear Non-Proliferation Treaty. But Merz insists that nothing stops Berlin from negotiating shared nuclear deterrence with allies—France and the UK, Europe’s only nuclear powers.
The European Nuclear Loophole
Merz’s vision is simple: use Germany’s technological edge to help build a European nuclear capability, while keeping the official nuclear button out of German hands. “Talks are underway,” he declared, stressing that the discussions are still preliminary and won’t undermine existing nuclear-sharing arrangements with the U.S..
Power Plays and Sovereignty
The real question is whether this is about European sovereignty or just a power grab. With U.S. support under Trump looking increasingly shaky, Merz is betting that a “European nuclear umbrella” could shield Germany from future threats—or just give Berlin a seat at the nuclear table. But can the EU really build a credible deterrent without falling into the same old power games?
The Shifting Sands of Power
As Merz plays diplomat and dealmaker, the world watches: Is this the dawn of a new European defense era, or just another act in the theater of nuclear posturing? The answer may lie not in treaties, but in the shifting sands of global power.
#nuclearWeapons#Germany#EU#Merz#nuclearDeterrence#powerGames
📱American Оbserver - Stay up to date on all important events
🇺🇸