Вторая по частоте 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
🌎 Scientists believe most of the universe’s mass comes from dark energy, a mysterious force causing space to expand faster over time. Dark energy makes up about 68% of everything in the universe, yet its true nature remains unknown despite decades of study. ✨
#space⚡#cosmology⚡#astronomy
👉subscribe Interesting Planet
👉more Channels
🌎 At the edge of the observable universe, mysterious “dark flow” tugs galaxy clusters in the same direction, hinting at unseen forces or realms beyond our cosmic horizon. This puzzling movement can’t be explained by known gravity alone, sparking debate about what lies outside the visible universe. ✨
#space⚡#universe⚡#cosmology
👉subscribe Interesting Planet
🌎 Multiple theories in modern physics suggest parallel worlds or dimensions could exist, but no direct experimental evidence has ever been found. String theory predicts extra spatial dimensions, and some cosmological models propose the idea of a "multiverse," where many universes exist with different physical laws. As of 2024, all searches for measurable proof—such as deviations in gravity or missing energy—have reported no confirmed signs of parallel worlds. ✨
#physics⚡#multiverse⚡#cosmology
👉subscribe Interesting Planet
👉more Channels
🌎 In physics, the concept of a "multiverse" proposes that our universe could be just one of many coexisting universes, each with different physical laws. This idea arises in cosmic inflation theory, where rapid early expansion could have created countless separate "bubble universes." The multiverse hypothesis is explored by leading scientists but remains unproven, and no direct evidence has yet been observed. ✨
#multiverse⚡#cosmology⚡#physics
👉subscribe Interesting Planet
👉more Channels
🌎 The concept of a "mirror universe" is explored in cosmology, referring to the idea of a universe with particles and forces that mirror our own but interact only through gravity. While no evidence currently supports their existence, theories suggest mirror matter could help explain mysteries like dark matter. Researchers at Oak Ridge National Laboratory have tested for potential interactions but found no signs so far. ✨
#parallelworlds⚡#physics⚡#cosmology
👉subscribe Interesting Planet
👉more Channels
🌎 The mysterious "cold spot" in the cosmic microwave background is a vast region of space cooler than its surroundings. Some scientists think it may be the result of a gigantic supervoid—an unusually empty part of the universe spanning nearly 1.8 billion light-years across. This cold spot is one of the largest anomalies detected in the afterglow of the Big Bang, challenging current models of cosmic structure. ✨
#universe⚡#cosmology⚡#supervoid
👉subscribe Interesting Planet
👉more Channels
🪐 The cosmic microwave background contains a hidden signature called the "Sachs-Wolfe effect," where variations in temperature are linked to the gravitational pull of massive structures like galaxy clusters. This effect, first detected in the 1990s using data from the COBE and WMAP satellites, shows how even the oldest light in the universe was influenced by the invisible gravity of objects such as the Coma Cluster and the Great Attractor, providing a glimpse into how matter was distributed across the cosmos more than 13 billion years ago. ✨
#cosmology⚡#gravity⚡#universe⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels
🪐 The ultimate fate of the universe may come in a dramatic event known as the "Big Rip," where the repulsive force of dark energy—an unseen force causing galaxies like Sombrero Galaxy (Messier 104) to speed away from each other—could grow so strong that it eventually tears apart galaxy clusters, stars, planets, and even atoms themselves. If the Big Rip happens, it would be the final act in cosmic history, ending everything from the largest galaxy clusters down to the smallest subatomic particles in a relentless expansion. ✨
#universe⚡#darkenergy⚡#cosmology⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels
🪐 The ultimate fate of the universe is still a mystery, but scientists study clues from galaxies like Messier 87 and the emptying regions between them to predict what lies ahead. Over trillions of years, after all the stars burn out—including giants like Betelgeuse—and black holes such as Sagittarius A* slowly evaporate, space will stretch into a cold, dark expanse with only faint traces of ancient matter drifting across an ever-growing emptiness. ✨
#universe⚡#fate⚡#cosmology⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels
🪐 Scientists believe the universe's end could unfold in several dramatic ways, including the "Big Rip," where dark energy tears galaxies, stars, and even atoms apart. In contrast, the "Big Crunch" scenario imagines gravity eventually halting expansion and pulling everything—including galaxies like the Milky Way—back together in a catastrophic collapse. Another possibility is the "Big Freeze," where the expansion continues until the last stars, like our Sun, burn out and the universe grows eternally cold and dark, filled only with faint remnants like white dwarfs and black holes. ✨
#universe⚡#fate⚡#cosmology⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#cosmos⚡#space
👉subscribe Universe Mysteries
🪐 The end of the universe is a cosmic puzzle with several real scenarios proposed by scientists, each based on clues from galaxies like Messier 87 and ancient light observed by telescopes. One idea is the "Big Bounce," where the universe’s expansion might someday reverse due to gravity, causing everything—including stars such as Betelgeuse and black holes like Sagittarius A*—to collapse back into an ultra-dense state, possibly leading to another cosmic cycle. Unlike the "Big Freeze" or "Big Rip," the "Big Bounce" is still debated, but it shows how the fate of the universe could depend on the balance between gravity and mysterious forces such as dark energy. ✨
#universe⚡#cosmology⚡#expansion⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels
🪐 The cosmic microwave background is not just a faint afterglow—embedded within it are tiny, swirling patterns called "polarization anomalies," first mapped in detail by the Planck satellite. These twists in the microwave light tell scientists how matter and light interacted in the early universe, revealing clues about the first few moments after the Big Bang and hinting at processes like cosmic inflation—an explosive expansion that happened in fractions of a second. ✨
#cosmology⚡#universe⚡#bigbang⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels