Вторая по частоте 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
The story has always been there.
DeckForge is more than just a game.
It’s a world with its own rules, its own power, and its own history.
Until now — you’ve only seen the surface.
But starting this week, the veil begins to lift.
We’ll reveal the origins.
The forces at play.
The Forge at the center of it all.
Welcome to the beginning of DeckForge lore.
Stay tuned — the world is about to speak..
#DeckForge#LoreUnfolds#NewChapter
Join the DeckForge Community:
🌐YouTube𝕏Twitter
👉Chat👉Announcements
🇷🇺❤Today marks a monumental chapter in my journey, as I proudly announce that I've become a Russian citizen and participated in my very first election here.
This significant step is more than just a formal process; it symbolizes my deep connection and commitment to my new home, its people, and its future. As I stood in the polling station, casting my vote, I was overwhelmed with a sense of responsibility and belonging.
This act of civic engagement is a powerful reminder of the role we each play in shaping the course of our community and nation. It's a day filled with emotions - pride, hope, and anticipation for what lies ahead.
Joining my fellow citizens in this democratic process, I felt a strong bond of unity and shared purpose. Here's to embracing new beginnings, contributing to the collective future, and making every moment count in this beautiful journey.
#Citizenship#ElectionDay#NewChapter#RussianCitizen🇷🇺✨
Sono entusiasta di condividere un nuovo capitolo del mio personale brand journey! 🚀 Con grande orgoglio, annuncio il mio recente "upgrade" strategico dello stile personale: ho scelto di vestirmi, un passo fondamentale per evolvere il mio stato da "nudo" a "diversamente nudo". 👔✨ Questa scelta si allinea perfettamente con i miei valori di crescita professionale e di impatto visivo, segnando un momento chiave nella mia missione di esprimere al meglio il mio potenziale. 🌟📈#NewChapter#StyleEvolution#PersonalBranding#GrowthMindset
🔄🇺🇿 #15 — 4 Kun ichida 3 ish taklifi: Hayotimdagi yangi bosqich
Oradan 4 kun o‘tgach, men topshirgan Birlashgan Arab Amirliklaridagi kompaniyalardan menga qo‘ng‘iroq bo’ldi. Ular intervyu o‘tkazishdi. Tez orada 3 ta ish taklifini oldim. Qanday ish deb qiziqayotgan bo‘lsangiz, offitsiant (waiter)— bu ishga kirish va ketish uchun eng oson yo‘llardan biri.
Bu jarayon menga sabr, qat’iyat va Allohga tavakkul qilishning ahamiyatini yana bir bor eslatdi. Harakat qilmasdan, faqat orzu qilish bilan hech narsaga erishib bo‘lmaydi. Har bir qadam, har bir qaror — bu yangi imkoniyatlarga yo‘l ochadi.
🔄🇬🇧 #15 — 3 Job Offers in 4 Days: A New Chapter Begins
Just three days later, I received a call from the companies I had applied to in the United Arab Emirates. They conducted an interview, and soon after, I received three job offers. Curious about the role? It's a waiter position — one of the easiest entry points into the job market there.
This experience reminded me of the importance of patience, determination, and placing trust in Allah. Simply dreaming without taking action leads nowhere. Every step, every decision opens doors to new opportunities.
#EverythingILived#TrustInAllah#Action#Dua#Dreams#Dubai#NewChapter
С ВЕСНОЙ ВАС🤍🕊️✨
#highlevel#newchapter#goldenedition
Photobombed me @hristy__🧨
Makeup & hair @elena__muah💋
#muse#яработаюмузой#actress#actrice#model#legslegslegs#elevation#higher#postcard#spring#springspringspring#springfashion#moodoftheday#photography#photooftheday#lady#mademoiselle#purelove#heavenonearth#благодарю#люблю#свеснойвас#доброеутро#petitefemme#mira#женщинамира#карповичмирослава