Вторая по частоте 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 Daily Gwei (🔗YouTube)
🔗ETH infinite bid, Ethereum's next 10 years and more - The Daily Gwei Refuel #845 - Ethereum Updates
Subscribe to the newsletter: https://thedailygwei.substack.com
Follow me on Twitter: https://twitter.com/sassal0x
Follow The Daily Gwei on Twitter: https://twitter.com/thedailygwei and https://twitter.com/DailyGwei_TV
Join the Discord channel: https://discord.gg/4pfUJsENcg
--------------------------------------------------
The Daily Gwei Refuel gives you a recap every week day on everything that happened in the Ethereum and crypto ecosystems over the previous 24 hours - hosted by Anthony Sassano.
--------------------------------------------------
Timestamps and links 👇
00:00 Introductory song
https://x.com/sassal0x/status/1955246612789465572
01:40 ETH treasury companies on fire
https://x.com/SERdotxyz/status/1955458142977810600
17:14 The ETH ETFs seeing record flows
https://x.com/sassal0x/status/1955461999862878368
23:21 The SEC's...
View original post
~
₿izFeed#⃣:#daily
OKX XP Marathon - S3
Run the long game 🏃🏻♀️🏃🏻♀️🏃🏻♀️
Prize:
250 USDT waiting for you to win!
🥇 1st : 60 USDT
🥈 2nd : 50 USDT
🥉 3rd : 40 USDT
🎁 4th : 30 USDT
🎁 5th : 20 USDT
🎁 6th–10th : 10 USDT each
How to earn points👇
1. Sign up on OKX (If you haven’t already)
2. Join & stay in OKX Global Discord (Must)
3. Chat actively in #general-chat to earn XP🏆 and use the hashtag # XPMarathonS3
4. Valid messages only (No spam, No links)
5. Send 'Win XP' to #daily-check-in to earn extra points 👉 100xp
6. Submit this Form for reward distribution
📆 Event Period: 4/2/2025, 9:30 AM - 13/2/2026, 6:00 PM (GMT+8)
👇
Join now
Our Socials:
⚜️Sign Up on OKX | Join Affiliate | TG | DC | Wallet TG | Wallet Announcement | OKX on Spotify | Twitter/X | YouTube
⭐️CN DC | CN TG
‼️Please check the authenticity of all OKX links or channels at OKX channel verification