Вторая по частоте 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
Kraken has officially stated that they have no intentions of delisting #USDT🟢 in Europe and will continue to offer the stablecoin to its users in compliance with upcoming regulations. They are committed to providing all relevant stablecoins to their European 🇪🇺customer base.☄️🌐
#Cryptosignals
#Bitcointrading
#Cryptocurrencynews
🔖🇺🇸Donald Trump’s Crypto Holdings Exceed $10M Ahead US Presidential Election✨
💵Republican presidential candidate Donald Trump's crypto portfolio value has surpassed $10 million as the MAGA (TRUMP) meme coin price surged, in which he has invested a staggering $7.3 million.
#Cryptolover
#Cryptosignals
#Bitcointrading
#Cryptocurrencynews
❗️Just-In: MEV Designated As “Illegal” Market Abuse Under EU MiCA Regulation
🔖The European Union (EU) has reportedly designated Maximum Extractable Value (MEV) as illegal market abuse under MiCA regulation
#Cryptolover
#Cryptosignals
#Bitcointrading
#Cryptocurrencynews
⚡️Taiko Thanks Vitalik Buterin Amid Layer 2 Launch On Ethereum Mainnet
💰Taiko expresses gratitude towards Vitalik Buterin as it goes live on Ethereum mainnet, highlighting the project's focus on scalability, security, and community engagement.
#Cryptolover
#Cryptosignals
#Bitcointrading
#Cryptocurrencynews
✨XRP Healthcare Ceases XRP To XRPH Swap Facility Amid Supply Crunch, What’s Happening❓
XRP Healthcare has announced that it plans to cease the XRP To XRPH swap facility as soon as June 7th or when the supply goes dry, aiming to preserve and increase scarcity for XRPH.
#Cryptolover
#Cryptosignals
#Bitcointrading
#Cryptocurrencynews