Вторая по частоте 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
🎓✨ CONGRATULATIONS! ✨🎓
To all Jimma University students who passed the exit exam and will graduate this Saturday! 🌟
Your hard work and determination have led to this proud moment. Wishing you a future full of success, peace, and new beginnings! 🌍🎉
#JIFAR CAREER
Eid Mubarak! ✨ May this special day bring you joy, peace, and countless blessings. Wishing you and your loved ones happiness, prosperity, and togetherness. Enjoy the festivities and spread kindness! 🌙💙
#JIFAR CARRER
For those of you who find creativity challenging, try this
✨ Team up with someone who has similar goals or works on related projects.
Their ideas and experiences might open new doors and inspire fresh solutions.
Collaboration can increase your creativity and lead to amazing results—give it a try! 👊
#JIFAR TUTOR
@JifarSupport
Honoring and Memorizing this photo☺️😊
## JIFAR TUTOR:Unleash Your Potential, Embrace the JImma Aba Jfar Legacy
JIFAR TUTOR:Where History Inspires Your Future
> At JIFAR TUTOR, we're dedicated to bringing history to life, inspiring students to unlock their own potential and shape their own futures.
> Our Legacy
> * Student Spotlight Series: Hear from real students who are finding their own voices and shaping their own destinies, inspired by JImma Aba Jfar's example.
> * "Beyond the Textbook" Experiences: Explore local historical sites, connect with experts, and delve deeper into JImma Aba Jfar's legacy through real-world experiences.
> With JIFAR TUTOR, you'll:
> * Develop essential skills for success in the 21st century: critical thinking, communication, and problem-solving.
> * Discover your own leadership potential and find inspiration for creating positive change.
📝Visit Our channels: @JIFAR1
🛎Call 24/7':@JifarSupport 0953484398
#JIFAR TUTOR
#JIFAR TUTOR
New Job opening‼️
🎆We are Jifar Tutor🎆
✍️Place: Tshire
✍️Student: Grade 11
✍️Duration: 4 or 3 in a week
✍️Salary: monthly by Agreement
✍️#Females apply for this job
✍️ Subject All
📖We need punctual and who have excellent professional ethics and applicants for this position.
#Jifar HomeTutor #ጅፋር#ቤትለቤት(Online) #አስጠኚ
#በፈለጉን#ሁሉ#አለን! #
#የልጅዎ#እና#የርስዎ#ቀዳሚ#አጋር!
በዚህ ያናግሩን @JifarSupport
🎆 Jifar Tutor your choice🎆
ከታች ያለዉን የቴሌግራም ቻናላችን ይቀላቀሉ
👉@Jifar1
✅Job status - CLOSED‼️