Вторая по частоте 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
Another mining has appeared in Telegram, in this one we are farming the token $CUBE
🏆Start CUBE Mining
Entry price is - 39⭐️
The price may increase at any time to avoid the load!
You can also complete tasks for free and get entry!
Don't miss out! Get in among the first!
Link ➡️@Cubeapp_bot
We will follow the project and its development!
⭐️Buy stars for ton⭐️
#cube#ton
In Game ❓ CUBES has released a useful update — now you can unite with the whole clan and mine the pool!
❤️ Now, together with #TonEvents we farm cubes even more efficiently and divide the loot among everyone, in proportion to your contribution:
2.5% of the production goes to the development of the pool, 12.5% goes to the lucky person who gets the cube, and the remaining 85% is divided among all pool participants
⛏ Each of you can boost our pool, that is, add 1,000 drops to the boost, then the next level of the pool will open and farming will become even more profitable, especially after halving, so we need to collect 500,000 drops.
⚰️ After the intermediate drop from #CUBE, the hamsters “abandoned ship,” but real miners know that now is the time to farm.
👍 Therefore, we all join in and raise our pool to the top, because the next halving is just around the corner.
⚡️Boost | 🌐Twitter
В Telegram появился еще один майнинг, в нем мы фармим токен $CUBE
🏆Запустить Майнинг CUBE
Цена входа составляет — 19⭐️
Цену могут повысить в любой момент, дабы избежать нагрузки!
Также можно выполнить задания бесплатно и получить вход!
Не пропускаем! Залетаем в числе первых!
Ссылка ➡️@Cubeapp_bot
Будем следить за проектом и его развитием!
⭐️Купить звёзды за ton⭐️
#cube#ton
💎 Auto Text自动回复v5.9.4解锁高级版 46.2
♻️资源介绍:Auto Text(原Do It Later)是一款简洁好用的以后再做计划程序应用,有了 Do It Later Pro 即使您在睡觉、忙碌或不在手机旁时,也可以给某人你发送短信(SMS)
⬇️本地下载
🔔标签:#安卓软件#PDF#合并#拆分#Cube#Page