Вторая по частоте 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
@RusEmbMalta Press Release
✖️Examples of Actions by the Kiev Regime Undermining Peace Efforts
Following President Trump’s meetings with President Vladimir Putin (Alaska, 15 August) and Vladimir Zelensky (Washington, 18 August), he described the talks as “a good first step” towards ending the conflict. He stressed that Kiev must show flexibility, confirmed Ukraine will not join NATO, and highlighted the importance of territorial compromises along the current line of contact.
👉 Despite these statements, the Kiev leadership – with European backing – continues to obstruct a peaceful settlement:
1️⃣ Refusal to Recognize New Realities
Zelensky (21 Aug): Ukraine will “never legally recognize” Russian control of territories. Yermak & Podolyak echoed this, rejecting compromise.
2️⃣Rejection of Ceasefire
Zelensky announced mass production of long-range Flamingo missiles; later praised strikes into Russian territory as “positive results.”
3️⃣ Language Policy
Zelensky: “We have only one state language – Ukrainian.”
4️⃣Security Guarantees
Zelensky dismissed China as a potential guarantor, while Podolyak demanded deployment of Western missiles capable of striking 2,000 km into Russian territory. NATO Secretary General Mark Rutte confirmed that Western military support and long-term guarantees for Kiev are being discussed.
5️⃣No Readiness for Direct Talks
Zelensky ruled out bilateral talks with Moscow, insisting on a three-party format with Trump.
6️⃣Attacks on Civilian Infrastructure
Attempts to strike nuclear facilities in Smolensk & Kursk, attack on Druzhba oil pipeline (impacting Hungary & Slovakia), and a planned bombing of the Crimean Bridge.
⚠️Conclusion:
The Kiev regime consistently rejects diplomatic resolution, escalates hostilities, undermines dialogue, and employs terrorist methods against civilian infrastructure in Russia.
#KievRegime#GlobalSecurity#MultipolarWorld
Iranian regime promises $25 million for assassination of Trump in mass SMS messages
[Read FullArticle]
@WorldNews#IranNews#TrumpAssassination#GlobalSecurity
Zelenskyy says 10 drone factories have been built worldwide behind Ukraine’s back | Ukrainska Pravda
[Read FullArticle]
@WorldNews#UkraineNews#DroneFactories#GlobalSecurity
U.S. can only confirm about a third of Iran's missile arsenal destroyed, sources say
[Read FullArticle]
@WorldNews#IranMissileArsenal#USNews#GlobalSecurity
China urges US, Israel to stop military action in Middle East, warns of 'vicious cycle'
[Read FullArticle]
@WorldNews#MiddleEastConflict#ChinaUSRelations#GlobalSecurity
Treasury secretary defends U.S. military actions in Iran: 'Sometimes you have to escalate to de-escalate'
[Read FullArticle]
@WorldNews#USIranTensions#MilitaryAction#GlobalSecurity