Вторая по частоте 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
Канье Уэста снова выпустили из дурки, и он пришёл на стрим, где включил демку своей новой песни под названием Heil Hitler.
Вот отрывок из его трека: «Все мои ниггеры — нацисты. Хайль ниггер. Хайль Гитлер».
Также рэпер к своим автографам теперь добавляет свастику.
Других новостей мира музыки у нас для вас нет
r/#Kanye
🎤 Kanye West 🌍 has publicly apologized to a rabbi for anti-Semitic remarks. ✨
American rapper Kanye West, known under the pseudonym Ye, has publicly apologized for his anti-Semitic statements for the first time. ☝️
The musician met with Rabbi Yeshayahu Yosef Pinto in New York and explained his past antics as a struggle with bipolar disorder. 😔
He added that he wants to start the road to recovery and "return to peace and love." 💖
Rabbi Pinto, a well-known preacher and spiritual mentor, replied to the musician: "It's not his mistakes that define a person, but how he corrects them. True strength lies in the ability to learn and build bridges of love and peace." 🗯✅
At the end of the meeting, he hugged the rapper and wished him "only the best in the future." 🤗👏
Kanye West has previously made a series of anti-Semitic statements in which, among other things, he praised Hitler and spread conspiracy theories. 🚫
His contracts with Adidas, Balenciaga and other brands were terminated, and his fortune was reduced by billions of dollars. 📉
#Kanye#Antisemitism
👂More on Trump's Ear
🚀 Overview of SBTI's 28 Personality Types
PANews posted on X (formerly Twitter) about the 28 distinct personality types identified by SBTI. These include the 'Controller' who excels in task management and situation handling, and the 'ATM-er' who invests time and emotional value. The 'Dior-s' represents a self-deprecating narrative under pressure, while the 'BOSS' is goal-oriented with strong organizational skills. The 'Thanker' leans towards positive feedback and gratitude, whereas the 'Oh-No' personality anticipates risks and negative outcomes. The 'GoGo' is action-driven, and the 'Sexy' emphasizes style and attraction. The 'Lover' is emotionally invested, and the 'Mum' is nurturing and concerned. The 'Fake' wears a social mask, and the 'OJBK' is conflict-averse. The 'Malo' resonates with the working class, while the 'Joker' uses humor to mask vulnerability. The 'WOC!' is highly reactive, and the 'Thinker' is analytical. The 'Shit' is cynical but often cleans up messes, while the 'ZZZZ' strategically disconnects. The 'Poor' is resource-conscious, and the 'Monk' is restrained and detached. The 'IMSB' is self-deprecating, and the 'Solo' is independent. The 'FUCK' is direct and rebellious, while the 'Dead' feels drained. The 'IMFW' has a low self-assessment, and the 'HHHH' finds humor first. The 'Drunk' is a hidden personality, and the 'Kanye' remains mysterious.
#SBTI#PersonalityTypes#Controller#ATM#Dior#BOSS#Thanker#OhNo#GoGo#Sexy#Lover#Mum#Fake#OJBK#Malo#Joker#WOC#Thinker#Shit#ZZZZ#Poor#Monk#IMSB#Solo#FUCK#Dead#IMFW#HHHH#Drunk#Kanye