Вторая по частоте 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
🌟 MYSTIC GARDEN: WHERE MAGIC MEETS GAMING 🌟
SingSing proudly presents an upcoming game - Mystic Garden, a GameFi adventure! 🌱 Grow elemental plants, craft NFTs, harvest BNB rewards, and battle for leaderboard supremacy. 💎
🚀Launchpool Alert!
We’ll snapshot launchpool participants to grant early access to Mystic Garden and offer exclusive rewards!
Join Launchpool now - https://t.me/SingSing_TG_bot/app?startapp=_launchpool
📌 Launch Date: Coming Soon.
Follow us for whitelist spots and updates!
#GameFi#NFTGaming#SingSing
🌟 Exciting News! 🌟
The Map feature is NOW LIVE on Mystic Garden! 🗺✨
🌿 Claim your land
🌸 Build & grow multiple gardens
🔍 Track everything seamlessly on the map
💡 It’s time to create your very own Mystic World! Ready to explore? 🚀
#MysticGarden#GameFi#NFTGaming
🎤Announcement| Mystic Garden Game |Chat| Spotlight Channel
🚨SingSing Tycoon Update Alert🚨
📜NFT Update
• NFTs from Lucky Spin are now locked for trading.
• Burning these NFTs is possible, but no $KARA rewards will be given upon burning.
💸Earning Update
• Perform Daily Wallet Check-in to enjoy 100% earnings speed.
• Miss it? You'll only earn at 50% speed.
Stay tuned and optimize your Tycoon journey! 🌟
#SingSing#NFTGaming#tycoon
🎤Announcement | Chat | X (Twitter) | Website | Game
💎 MYSTIC GARDEN: UNIQUE FEATURES 🌱
• 6 Elemental Plant Types to grow & harvest.
• Craftable Magic Pots & Elves for strategic boosts.
• Daily AURA Rewards to keep the magic flowing.
• Special Event Seasons with exclusive prizes.
Unlock a magical gaming experience like no other! 🚀
#MysticGarden#GameFi#NFTGaming#SingSing
🚨 Tycoon Master Showdown #5 is coming! 🚨
🔥 Prize Pool: BIGGER x MANY TIMES – you won't want to miss this!
💎Pssst... Your NFTs will be the key to securing your spot in this epic showdown. Time to HODL them tight! 👑
📢 Stay tuned for more juicy deets soon.
#SingSingTycoon#NFTGaming#BigRewards
🎤Announcement | Chat | X (Twitter) | Website | Game
🐶Lost Dogs:The Way -
🏆Last Round’s Winner: Fireworks🎆
📝New Challenge:
Which tactic to choose? (Find an average card)
1. Surround 🌀
2. Frontal Attack 🚀
3. Fake Retreat 🎭
🔍Analyze carefully before making your choice!
🔔Subscribe👉Join Lost Dogs
—————————————————
#lostdogs#crypto#dogs
#cryptogame#nftgaming
🐶Lost Dogs:The Way -
🏆 Last Round’s Winner: Decryption Machine
📜New Challenge:
How to handle the new information? (Find the average card)
1. Tell Everyone 📢
2. Hide the Truth 🔥
3. Defuse 🛡️
🔍Analyze carefully before making your choice!
🔔Subscribe👉Join Lost Dogs
—————————————————
#lostdogs#crypto#dogs
#cryptogame#nftgaming
🐶Lost Dogs:The Way -
🥇 Last Round’s Winner:
The winning card in the last game was Go Underground🌿
🚀New Challenge:
What truth will the Resistance reveal? (Find the average card)
1. Greed of the Cult 🪙
2. About Religious Lies 📖
3. How to Resist 🛠
🔍Analyze carefully before making your choice!
🔔Subscribe👉Join Lost Dogs
—————————————————
#lostdogs#crypto#dogs
#cryptogame#nftgaming
🐶Lost Dogs:The Way -
🥇 Last Round’s Winner:
The winning card in the last game was Kidnap🐾
🚀New Challenge:
How can Resistance continue the fight? (Find the unpopular card)
1. Invite Newcomers 👥
2. Go Underground 🌿
3. Pirate Radio 🎙
🔍Analyze carefully before making your choice!
🔔Subscribe👉Join Lost Dogs
—————————————————
#lostdogs#crypto#dogs
#cryptogame#nftgaming
🐶Lost Dogs:The Way -
🏆 Last Round’s Winner: The winning card in the last game was Fend Off in Battle! 🛡️
🚀New Challenge:
How should the Resistance Dogs handle the newly born mutant messiah? (Find the average card) 👣
1. Kidnap 🐾
2. Kill ⚔️
3. Unveil the Origin 🔍
Analyze carefully before making your choice!🧐
🔔Subscribe👉Join Lost Dogs
—————————————————
#lostdogs#crypto#dogs
#cryptogame#nftgaming
🐶Lost Dogs:The Way -
🏆 Last Round’s Winner: The winning card in the last game was Wisdom! 👣
🚀New Challenge:
How will they rescue Genghis Gaf, and will they?
1. Fend Off in Battle🔥
2. Stay Low 🏠
3. Rescue Secretly 🤘
Analyze carefully before making your choice!
🔔Subscribe👉Join Lost Dogs
—————————————————
#lostdogs#crypto#dogs
#cryptogame#nftgaming
🐶🐶Lost Dogs: The Way - 🏆Last Round’s Winner: The winning card in the last game was Fight Back!👣
🚀New Challenge:
What are the dogs expecting from their beloved wizard's performance?
1. Underground Firework 🎆
2. New Day 🌅
3. Existence’s Purpose 🔮
Analyze carefully before making your choice!
🔔Subscribe👉Join Lost Dogs
—————————————————
#lostdogs#crypto#dogs
#cryptogame#nftgaming