Многие из тех кто активно работал с 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
🚀 Iran's Ten-Point Plan Gains Consensus as Negotiation Framework
On April 10, Iran's Deputy Foreign Minister Ravanchi announced during a meeting with foreign diplomats and international organization representatives in Iran that a consensus has been reached to use Iran's ten-point plan as the basis for negotiations. According to BlockBeats, Ravanchi emphasized Iran's openness to diplomacy and dialogue but firmly rejected any discussions based on false information intended to deceive or pave the way for renewed military aggression against Iran.
#Iran#Diplomacy#Negotiation#InternationalRelations#ForeignPolicy
🚀 Dollar Faces Pressure Amid US-Iran Negotiation Reports
The dollar-and-oil buying trade is experiencing challenges as reports of negotiations between the United States and Iran surface. According to NS3.AI, the US Dollar Spot Index has decreased by approximately 1.4% this week, marking its largest weekly drop since January. This decline is attributed to shifts in foreign exchange trading, influenced by headlines surrounding the negotiations and a fragile ceasefire.
#Dollar#US#Iran#Negotiation#Forex#Oil#Ceasefire#CurrencyMarket
🚀 Trump Denounces Reports on Iran Negotiation Plan as False
U.S. President Donald Trump has criticized reports from The New York Times and CNN regarding a ten-point plan on Iran negotiations. According to Odaily, Trump labeled these reports as entirely fabricated and aimed at discrediting those involved in the peace process. He dismissed the points as fraudulent schemes and called the media outlets 'evil losers.' Trump concluded his statement with a call to 'Make America Great Again.'
#Trump#Iran#Negotiation#USPolitics#Media#FakeNews#PeaceProcess#MAGA
🚀 Trump Criticizes Iran's Media Tactics on Truth Social
U.S. President Donald Trump expressed his views on Iran's media strategies on April 11 via Truth Social. According to BlockBeats, Trump stated that Iranians are more adept at handling fake news media and public relations than engaging in warfare. He remarked that Iran seems unaware of its lack of leverage, aside from short-term 'extortion' through international waterways. Trump concluded that Iran's current existence is solely for negotiation purposes.
#Trump#Iran#MediaTactics#FakeNews#PublicRelations#Negotiation#TruthSocial#Extortion#InternationalWaterways