Вторая по частоте 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
🎄✨ Celebrate the joy of the season with Loot Baba [Official]!🎉
Wishing you a magical Merry Christmas 2025🎅 and a prosperous New Year ahead! ⭐️💎
Let’s welcome the future with endless opportunities and happiness! 🎁🔥
#merrychristmas@LootBaba_Officiall
Wishing all Nigerians a healthy and joyful Christmas! 🎄
May the spirit of the season bring happiness and well-being to your homes.
Stay safe, cherish moments, and embrace the gift of good health.
#MerryChristmas!🎄🎄
🇮🇩 Public Holidays in Bali
🎅 December 25 and 26 are official public holidays across Indonesia.
On these days, government institutions will be closed (including banks, tax offices, municipal offices, and other public services).
#MerryChristmas@BaliNews
¡Ay papá! Se acerca el #24Dic y lo que viene es rumba. Salí con Cilita a dar un recorrido por las calles de Caracas, vimos las fiestas navideñas; nuestro Pueblo está ejerciendo el derecho más bonito que tiene: el de la felicidad, vivir en Paz y disfrutar de este tiempo de unión. “¡No War!” #MerryChristmas
«Эта ночь принадлежит кроткому, посему пусть каждый отложит ярость и суровость, – принадлежит смиренному, пусть каждый обуздает свою гордость и смирит свое высокомерие. Ныне воссиял день милости, да не преследует же никто мщением нанесенной ему обиды; настал день радости, да не будет же никто виною печали и скорби для другого». (Ефрем Сирин. Слово на Рождество Христово). #καλαχριστουγεννα#merrychristmas
🎄✨ Merry Christmas from SingSing! 🎄✨
As the year comes to a close, we want to take a moment to express our heartfelt gratitude to our incredible SingSing community. 💖 Your unwavering support, enthusiasm, and passion have been the driving force behind everything we’ve accomplished together this year.
From building a thriving ecosystem to launching exciting games and features, none of this would have been possible without YOU. 🌟
🎁 This holiday season, we wish you and your loved ones endless joy, peace, and togetherness. May your days be filled with laughter, love, and the magic of Christmas. 🎅
Here’s to an even brighter and more exciting year ahead! Together, we’ll continue to grow, achieve, and make SingSing the #1 platform for all. 🚀
With love and gratitude,
The SingSing Team 💎
#SingSing#MerryChristmas#HappyHolidays
🎅Дорогие подписчики Легкого Неба!
🎉От лица руководства канала мы поздравляем вас с 2026 годом, желаем вам счастья, здоровья и главное - чистого и Лёгкого неба над головой!
🎅Надеемся, совсем скоро дед Мороз прилетит по Лёгкому небу к вам!
❄️Happy New Year!
Команда Легкое Небо
#merrychristmas#newyear#happy