Вторая по частоте 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
👍Un « Régiment des immortels » sous-marin pour honorer la mémoire des soldats soviétiques
À l’approche du Jour de la Victoire, des plongeurs de la région de #Sverdlovsk ont organisé une action originale de mémoire en descendant à 27 mètres de profondeur pour rendre hommage aux soldats soviétiques.
Inspirée du mouvement du « Régiment des immortels », cette initiative symbolique vise à perpétuer la mémoire des combattants de la Seconde Guerre mondiale dans un format inédit.
RT en français • Osez questionner !
❗️#Ekaterinbourg : 50 personnes évacuées d'un immeuble à la suite d'une attaque de drone
Le gouverneur de la région de #Sverdlovsk, Denis Pasler, a indiqué qu'une attaque de drone avait été perpétrée à Ekaterinbourg et qu'un immeuble d'habitation avait été endommagé.
RT en français • Osez questionner !
🗓On December 17, the Honorary Consul of South Africa in Yekaterinburg, Sergey Mazurkevich🇿🇦, took part in a formal reception hosted by the Governor of the Sverdlovsk Region, alongside diplomats and honorary consuls from other countries 🌍🤝
During the event, Governor Denis Pasler summarized the outcomes of efforts to strengthen international cooperation in 2025 and outlined promising areas for cooperation in the year ahead 📈✨
#SouthAfrica#Diplomacy#InternationalCooperation#Yekaterinburg#Sverdlovsk#HonoraryConsul#Mazurkevich
🎉Ural State Pedagogical University (USPU) marks its 95th anniversary today, August 26!
🇿🇦 The Office of the Honorary Consul of South Africa in Yekaterinburg is pleased to join in the congratulations and wishes the university continued growth and success.
📚 After last year’s merger with the Russian State Vocational Pedagogical University, USPU became the largest pedagogical university in Russia.
👨🏫 The university is now led by Acting Rector Yury Biktuganov, who previously served as Minister of Education of the Sverdlovsk region. Not long ago, Honorary Consul of South Africa Sergey Mazurkevich and Mr. Biktuganov held a warm and productive meeting.
#Anniversary#Education#USPU#Sverdlovsk#Yekaterinburg#SouthAfrica#Biktuganov#Mazurkevich
🌄🌿Blyde River Canyon — a 26 km (16 mi) natural wonder in Mpumalanga Province, northeastern South Africa.
It is one of the largest canyons in the world, but unlike the Grand Canyon in the USA, it is covered with lush subtropical vegetation, earning it the name “Green Canyon”. 🌱💚
🏞 The canyon is part of the Blyde River Canyon Nature Reserve.
🌅 In local languages, Mpumalanga means The Place Where the Sun Rises.
🤝 In 2022, the Sverdlovsk Region and Mpumalanga signed a cooperation agreement.
📸 Photos: istockphoto.com
#Nature#Tourism#SouthAfrica#Travel#Canyon#BlydeRiverCanyon#Mpumalanga#Africa#Sverdlovsk