Вторая по частоте 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
News: #Somalia, #South_Africa discuss security, regional stability
Somali President #Hassan_Sheikh Mohamud on Tuesday held a telephone conversation with South African President Cyril #Ramaphosa, during which the two leaders discussed strengthening bilateral relations and expanding cooperation on peace and security, trade and investment, and regional stability.
According to Somalia’s state news agency SONNA, the talks also covered key regional and continental developments, with both leaders reaffirming their commitment to #African solidarity and shared prosperity.
Recently reports indicate that Somalia intensifies diplomatic relations with different countries. Yesterday SONNA reported.that Somalia has signed a defence cooperation agreement with #Qatar, days after formally terminating all existing security and defence arrangements with the United Arab Emirates (#UAE).
The agreement was...
https://web.facebook.com/AddisstandardEng/posts/pfbid0APngK9nL83rpkiaz2ADgk3Fhm1cZKE3Utxx6mMTkWx8RgG7w4yTYz191C3C5g6uAl
#South_Africa deploys soldiers to the streets to tackle organized and violent crime
Soldiers were deployed to the streets of South Africa’s biggest city Wednesday in an effort to help police fight gang violence and illegal mining.
It was the first major deployment since President Cyril #Ramaphosa said in his annual speech to the nation last month that he would use the army against organized crime, which he called the greatest threat to democracy and the country’s economic development.
Soldiers jumped from vehicles and entered apartment blocks as military vehicles moved through the #Riverlea and #Westbury suburbs of #Johannesburg.
Many residents of Riverlea expressed relief to see soldiers deployed to stem the violence.
One resident, Pearl Hilma, told The Associated Press that she supports the crackdown “because there’s lots of gangsterism as well as gunshots every night” in the neighborhood......
https://apnews.com/article/johannesburg-troops-crime-crackdown-president-d92dd6dc8eea76bdf1abd878200379f9
Un nuovo capitolo strategico tra Việt Nam e Sudafrica
La visita di Stato del Presidente sudafricano Cyril Ramaphosa a Hà Nội (23-24 ottobre) segna una svolta storica nelle relazioni tra i due Paesi. Dopo decenni di cooperazione politica ed economica, il Việt Nam e il Sudafrica si preparano a elevare il loro rapporto a Partenariato Strategico entro il 2025, fondato su fiducia politica, sviluppo sostenibile e convergenza multilaterale.
Le radici del legame risalgono alla solidarietà anticoloniale e al movimento afro-asiatico, ma oggi la partnership guarda al futuro: energie rinnovabili, digitalizzazione, infrastrutture, finanza verde e libero scambio con la SACU.
Il Việt Nam si conferma ponte tra Asia e Africa, mentre il Sudafrica punta a rafforzare il proprio ruolo di hub continentale.
Entrambi i Paesi condividono una visione del Sud Globale unito, promotore di un ordine internazionale più equo, basato su cooperazione, legalità e rispetto reciproco.
La dichiarazione congiunta del 24 ottobre non chiude un ciclo, ma ne apre uno nuovo: quello di una cooperazione Sud-Sud più matura, fondata su principi, pragmatismo e ambizioni globali comuni.
#Vietnam#SouthAfrica#Ramaphosa#CooperazioneSudSud#Diplomazia#Geopolitica#ASEAN#Africa#PartenariatoStrategico#GiulioChinappi
https://www.marx21.it/internazionale/un-nuovo-capitolo-strategico-nella-cooperazione-tra-vietnam-e-sudafrica/