Вторая по частоте 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
Just In: World Liberty Finance ( @worldlibertyfi ) sent 500M $WLFI worth $83.12M to #Jump Trading.
Data - @Nansen_ai
https://x.com/OnchainLens/status/2010748644979577089
Follow @onchainlens for more onchain updates
Shoutout to the early donators 🚀💥 You’re our real VIPs for jumping in first and supporting the new ETH memecoin season! 🙌💰
The more you #JUMP into $JUMP, the closer we get to make ETH great again 🌕🚀
Let’s f***ing jump and save Ethereum together!
Whales are starting to #JUMP into our donation 🐳🐳
A 70 #ETH donation just came in! It came from a very old and large wallet holding over 2500 ETH, the #MEGA movement is getting stronger by the day. Join the movement and make memes on Ethereum great again!
https://etherscan.io/tx/0x25b8397cda09027cc3bcc86ff2abf58fa2dc07022204dd8161a7b2630e658b7d
🚀 The wait is over - $JUMP is live! 🚀
Donate now and secure your stake in Jump.fun, the next-generation memecoin launchpad:
🔥 Liquidity War Mode (loot liquidity, win big!)
💰 FREE 6 ETH liquidity loan on Uniswap
⚡️ Community-ownership via $JUMP token
#jumpfun is the key to bring back memecoin FOMO and fun to the Ethereum ecosystem. #MEGA
🌕 Don’t just watch - #jump high, moon higher!
Crypto Summit Guest List Revealed
Notable figures like Kayne West and the Lazarus Group are invited to a major crypto summit. In related news, Mexican billionaire Ricardo Salinas has raised his Bitcoin holdings to 70%, moving away from gold investments. Meanwhile, Jump is resuming its U.S. crypto operations, boosting hiring amid rising trading volumes.
#Crypto#Bitcoin#Summit#Finance#Investing#Market#Jump#Arbitrum#LazarusGroup#Salinas