Вторая по частоте 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
🌎 In ancient Chavín culture of Peru, intricate stone “pututu” conch trumpets echoed across ceremonial plazas. These natural shell horns carried sound up to a kilometer, uniting crowds during old rituals and feasts with their deep, haunting music. ✨
#history⚡#sound⚡#archaeology
👉subscribe Interesting Planet
🌎 The "Bloop" is one of the loudest underwater sounds ever recorded. Detected by NOAA hydrophones in 1997, this low-frequency noise was picked up over 5,000 kilometers apart. Scientists later identified melting icebergs as the likely source, not a sea creature or submarine volcano. ✨
#ocean⚡#sound⚡#mysteries
👉subscribe Interesting Planet
👉more Channels
🌎 Mysterious low-frequency sounds known as "The Upsweep" have been picked up by underwater microphones in the Pacific Ocean since 1991. This persistent sound rises and falls in pitch, lasts several seconds, and is strongest in spring and autumn. Its source remains unidentified, but some researchers suggest volcanic activity near the origin point may be involved. ✨
#ocean⚡#mysteries⚡#sound
👉subscribe Interesting Planet
👉more Channels
#sound
#неКуКураж_круче
#КультМедиа
Профессиональная команда дикторов возьмётся за озвучку любого ролика.
Каз/Рус/Муж/Жен.
От литературных текстов до делового стиля, портфолио предоставим.
Опыт озвучки: аудиокниги, анонсы телеканалов, имиджевые ролики крупных компаний и городов и проч.
wa/tg: +7 777 240 22 42
t.me/cult_media
🌎 The “singing” sands of select deserts produce eerie musical tones when walked on or disturbed. This haunting sound comes from millions of perfectly sized sand grains rubbing together and vibrating in harmony—nature’s own desert orchestra! ✨
#geology⚡#sound⚡#phenomenon
👉subscribe Interesting Planet
🌎 Strange cosmic "whistlers" recorded by satellites are caused by lightning on Earth. These radio signals travel along Earth's magnetic field, bounce off space, and return as high-pitched, descending tones—lasting less than a second. Some whistlers have been traced over thousands of kilometers from their original lightning strike. ✨
#space⚡#sound⚡#lightning
👉subscribe Interesting Planet
👉more Channels
🌎 Earth’s Schumann resonances are a set of naturally occurring, low-frequency electromagnetic waves circling the globe between the ground and the ionosphere. These “global hums” are mainly generated by lightning and pulse mostly at 7.83 Hz, serving as a natural radio background measured by scientists worldwide. ✨
#space⚡#sound⚡#atmosphere
👉subscribe Interesting Planet
👉more Channels
🌎 Some of the loudest natural sounds ever recorded in the ocean come from snapping shrimp, which use their oversized claw to shoot a high-speed bubble. When the bubble collapses, it creates a sound reaching 210 decibels—louder than a gunshot—and can stun small prey nearby. ✨
#ocean⚡#animal⚡#sound
👉subscribe Interesting Planet
👉more Channels
🌎 Jupiter’s magnetosphere produces “chorus” radio waves—sounds like twinkling or whistling—detected by NASA spacecraft. These signals are created by energetic electrons moving along the planet’s powerful magnetic field. The Juno probe recorded these plasma waves in 2016. ✨
#Jupiter⚡#space⚡#sound
👉subscribe Interesting Planet
👉more Channels
🌎 The Voyager 1 spacecraft captured “plasma wave” sounds as it entered interstellar space in 2012. These sounds are actually electromagnetic vibrations in space, converted into audio by NASA scientists. The pitch and intensity help scientists measure the density of charged particles beyond our Solar System. ✨
#Voyager⚡#space⚡#sound
👉subscribe Interesting Planet
👉more Channels