Вторая по частоте 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
🔥 BingX $SING Fixed Savings is LIVE! 🚀
💰 Earn up to 200% APR by staking your $SING!
🏃♂️ Limited quota – subscribe now before it’s gone!
📅 Subscription Period: Now – Nov 24, 2024, 07:00 AM (UTC)
🔗 Start Staking: https://bingx.com/en/wealth/subscription?actId=&assetName=SING&productId=1374930318547673175&productType=1
⏳ Don’t miss out on this incredible earning opportunity!
#BingX#SingSing#Staking#CryptoEarnings
🔥 MetaGram: MGR Staking is LIVE
Stake your $MGR and earn up to 80% APR.
• Flexible lock terms: 7–365 days
• 0% platform fees while staking
• Trading pair: MGR/BNB (details soon)
👉Start now 👉👉👉👉👉👉👉👉
👉https://metagram.digital/staking
#MetaGram#MGR#DeFi#BSC#Staking#CryptoEarnings
🔥 MetaGram: MGR Staking is LIVE
Stake your $MGR and earn up to 80% APR.
• Flexible lock terms: 7–365 days
• 0% platform fees while staking
• Trading pair: MGR/BNB (details soon)
👉Start now 👉👉👉👉👉👉👉👉
👉https://metagram.digital/staking
#MetaGram#MGR#DeFi#BSC#Staking#CryptoEarnings
🔥 MetaGram: MGR Staking is LIVE
Stake your $MGR and earn up to 80% APR.
• Flexible lock terms: 7–365 days
• 0% platform fees while staking
• Trading pair: MGR/BNB (details soon)
👉Start now 👉👉👉👉👉👉👉👉
👉https://metagram.digital/staking
#MetaGram#MGR#DeFi#BSC#Staking#CryptoEarnings
🚀 USDC Holders May Face End of 4% Earnings Amid Legislative Push
PANews posted on X (formerly Twitter) that the days of earning a 4% return by holding USDC might be coming to an end. The American Bankers Association (ABA) has reportedly spent $56.7 million lobbying for the passage of the 'Clarity Act.' The primary aim of this legislation is to prevent users from obtaining returns similar to government bonds through stablecoin holdings. The banking sector's main concern is that if stablecoins can offer an annualized return of 4% to 5%, it could potentially impact up to $1.5 trillion in retail deposits.
#USDC#Stablecoin#ClarityAct#AmericanBankersAssociation#CryptoRegulation#CryptoEarnings#BankingSector#Legislation#RetailDeposits
🔥@CryptoDailyPrice – Your shortcut to daily crypto power! 💰
Get live price updates, learn pro trading tricks, and discover zero-investment earning hacks that actually work. 🚀
Stay tuned — every post drops something crucial, profitable, and mind-opening for crypto lovers like you! ⚡
#CryptoDailyPrice#CryptoUpdates#CryptoEarnings#CryptoTrading#CryptoTips#LearnToTrade#ZeroInvestment#CryptoForBeginners#DailyCryptoNews#PassiveIncome#CryptoSignals#CryptoMarket#CryptoProfit#StayTuned#EarnWithCrypto
💸 New Payment Received from Tonpick Faucet! 💸
💰 Hourly TON Faucet — Earn free TON easily!
✅ Claim faucet every 60 minutes
✅ Confirm your email to get 10 spins & 2X rewards for 24h
✅ Complete surveys for extra rewards
✅ Invite friends & earn 50% from their claims
💵 Min withdraw: only 0.1 TON
🌐 Join here:
https://tonpick.game/?ref=FREE_CRYPTO_TG
#TON#FreeTON#CryptoFaucet#CryptoEarnings#MakeMoneyOnline#Airdrop#FreeCrypto#PassiveIncome#WorkFromHome#CryptoRewards
---
💸 دفعة جديدة من Faucet Tonpick! 💸
💰 صنبور TON كل ساعة — اربح TON مجانًا بسهولة!
✅ المطالبة بالصنبور كل 60 دقيقة
✅ تأكيد بريدك الإلكتروني لتحصل على 10 دورات و ضعف الأرباح لمدة 24 ساعة
✅ إكمال الاستبيانات لربح إضافي
✅ دعوة الأصدقاء وربح 50% من أرباحهم
💵 الحد الأدنى للسحب: فقط 0.1 TON
سجّل الآن:
https://tonpick.game/?ref=FREE_CRYPTO_TG
#ربح_المال#كريبتو#TON#ربح_TON#ايردروب#PassiveIncome#ربح_مجاني#بوتات_تيليجرام#ربح_من_الانترنت