Вторая по частоте future-функция, которую я использовал, это абсолютный импорт
from __future__ import absolute_import
Что она делает?
Изменения, которые вносит эта инъекция описаны в PEP328
Покажу простой пример.
Допустим, есть такой пакет:
/my_package
/__init__.py
/main.py
/string.py
Смотрим код в my_package/main.py
# main.py
import string
Простой пример готов) Вопрос в том, какой модуль импортируется в данном случае? Есть два варианта:
1. модуль в моём пакете my_package.string
2. стандартный модуль string
И вот тут вступает в дело приоритет импортов. В Python2 порядок следующий: помимо иных источников, раньше ищется модуль внутри текущего пакета, а потом в стандартных библиотеках. Таким образом мы импортнём my_package.string.
Но в Python3 это поведение изменилось. Если мы указываем просто имя пакета, то ищется именно такой модуль, игнорируя имена в текущем пакете. Если мы хотим импортнуть именно подмодуль из нашего пакета то, мы должны теперь явно это указывать.
from my_package import string
или относительный импорт, но с указанием пути относительно текущего модуля main
from . import string
Еще одной неоднозначностью меньше 😎
Подробней про импорты здесь:
https://docs.python.org/3/tutorial/modules.html
#2to3#pep#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