Вторая по частоте 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 Pascagoula UFO Encounter
Interview and Documentary
The Pascagoula Abduction was an alleged UFO sighting and alien abduction in 1973, in which Charles Hickson and Calvin Parker claimed they were abducted by aliens while fishing near Pascagoula, Mississippi.
#aliens
AETATESOLIS
🪐 In 2023, scientists used the James Webb Space Telescope to study the atmosphere of the exoplanet K2-18b, located about 120 light-years away in the constellation Leo, and detected molecules like methane and carbon dioxide in its thick atmosphere. While this doesn't prove the existence of aliens, these chemicals are considered potential signs that could support life as we know it, making K2-18b one of the most intriguing worlds in the ongoing search for extraterrestrial life. ✨
#aliens⚡#exoplanets⚡#astronomy⚡#nasa⚡#galaxy⚡#stars⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
🪐 In 2015, scientists discovered a mysterious star called KIC 8462852, also known as "Tabby's Star," located about 1,470 light-years from Earth. This star shows unusually irregular and dramatic dimming events, with its brightness sometimes dropping by more than 20%, sparking curiosity because no natural explanation fully accounts for the strange pattern—though telescopes have found no evidence that the cause is artificial or linked to aliens. ✨
#aliens⚡#mysteries⚡#stars⚡#nasa⚡#galaxy⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
Project Bluebeam
Final Stage👽
DON'T TAKE THE BAIT
THEY WILL ENGINEER
THE RAPTURE AS AN ALIEN
ABDUCTION
#ufo#uap#aliens#disclosure#trump
https://t.me/TheSecretArchivesQ
🪐 In 2020, researchers using the LOFAR radio telescope detected strange bursts of low-frequency radio waves coming from the red dwarf star GJ 1151, about 26 light-years from Earth. These signals are thought to be created by interactions between the star and an orbiting planet, and while not proof of aliens, such emissions spark excitement because similar interactions could reveal planets that might host life. ✨
#aliens⚡#exoplanets⚡#radio⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries