Вторая по частоте 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
🐱 Выжиматор кошачьего корма – экологично, чисто и удобно!
Это удобное устройство поможет оставить руки чистыми от влажного корма и сделает кормление кошек проще! Без отходов, легко моется, быстро печатается на 3D-принтере!
🔗Скачать:Printables
#️⃣ Категория:#Pets@anzar3d
🖨3D модели для печати | 3D Маркетплейс | Max
Hamster Kombat Announcement: Celebrate International Hamster Day!
#hamster#pets
Hamster Kombat Announcement highlights International Hamster Day on April 12, a day to celebrate these adorable pets with treats and affection. Join in the tradition and make your hamster feel extra special.
Source: link
@tonlines
Furry friends receive blessings at Peru monastery
Animal lovers in Lima, Peru, had their pets blessed during a special mass for their four-legged friends at the Saint Francis Monastery.
#News#Reuters#Pets#Peru
Subscribe: http://smarturl.it/reuterssubscribe
Reuters brings you the latest business, finance and breaking news video from around the globe. Our reputation for accuracy and impartiality is unparalleled.
Get the latest news on: http://reuters.com/
Follow Reuters on Facebook: https://www.facebook.com/Reuters
Follow Reuters on Twitter: https://twitter.com/Reuters
Follow Reuters on Instagram: https://www.instagram.com/reuters/?hl=en
➖@reutersworldchannel➖
Nest Veterinary Secures $700K Funding
Nest Veterinary has successfully raised $700,000 in funding to support its innovative platform that enables users to create and manage customized wellness plans for pets. This funding round took place on December 16, 2024. For more details, visit Nest Veterinary.
#Veterinary#Funding#WellnessPlans#Pets#Startup
Russia Proposes Unified Pet Registry
The St. Petersburg Legislative Assembly has initiated a bill to create a unified registry for pets, requiring mandatory registration and tagging. The draft law is now in the State Duma. Owners must register their animals, aiding quick recovery if lost and identifying owners in case of damage. The government will approve which animals must be registered. A similar proposal led by deputy Nina Ostanina previously gained committee support.
#Russia#pets#registry#law#StateDuma
The main news of Russia and the world ishere.
Slideshow: Drive-through pet blessing
Hundreds of animal lovers in the Philippines had their pets blessed via a drive-through ceremony.
#News#Reuters#Drivethrough#pets#blessing#slideshow
Subscribe: http://smarturl.it/reuterssubscribe
Reuters brings you the latest business, finance and breaking news video from around the globe. Our reputation for accuracy and impartiality is unparalleled.
Get the latest news on: http://reuters.com/
Follow Reuters on Facebook: https://www.facebook.com/Reuters
Follow Reuters on Twitter: https://twitter.com/Reuters
Follow Reuters on Instagram: https://www.instagram.com/reuters/?hl=en
➖@reutersworldchannel➖
Jumping spiders are small spiders in the Salticidae family. They have four pairs of eyes, with large front eyes for hunting and navigation. They do not build webs to catch prey. They hunt by stalking and leaping on insects. They use silk as a safety line when they jump. Some species are kept as pets and are easy to care for.
🕷️🌿🎯
[Read more]
@googlefactss
#Spiders#JumpingSpider#Salticidae#Nature#Pets