Вторая по частоте 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
Бароҳат сафар намоед! Замимаи мобилии мо сафари шуморо қулай ва камташвиш хоҳад кард. Тариқи замима мусофирон имкон доранд ба осони сайёҳати худро ба нақша гирифта, чиптаҳоро бо нархи мувофиқу ҷойи муносиб интихоб намоянд ва маблағи бағоҷи аз меъёр зиёдро пардохт намоянд. Замима барои боргирӣ ба iOS ва Android дастрас мебошад.
📱
Путешествуйте с комфортом! Наше мобильное приложение сделает ваше путешествие более удобным и приятным. При помощи приложения пассажиры легко могут спланировать путешествие, подобрать оптимальный тариф для поездки, выбрать удобное место в салоне и оплатить сверхнормативный багаж. Приложение доступно для скачивания на iOS и Android.
📱
Travel in comfort! Our mobile app will make your journey more convenient and enjoyable. With the app, passengers can easily plan their trip, choose the best fare for their journey, select a comfortable seat, and pay for excess baggage. The app is available for download on iOS and Android.
#сомонэйр#somonair#mobileapp
👨🌾🚛 Dalatek — торговая онлайн-площадка в сфере сельского хозяйства. Мы создали для них мобильное приложение📲@dalatek.uz
Подпишись на нас, чтобы не пропустить новые публикации📢
👨🌾🚛 Dalatek — agro sohasida onlayn savdo platformasi.
#designer#mobileapp#Tashkent#Uzbekistan
Follow us: Telegram · Instagram · Dribbble
Attorney Shield Raises $451.96K
Attorney Shield has successfully raised $451.96K on December 17, 2024. The company focuses on enhancing interactions with law enforcement through its innovative mobile app and technology-driven legal services. For more information, visit their website here.
#AttorneyShield#LegalTech#Funding#AppDevelopment#MobileApp#LawEnforcement#Innovation
SociAbility Raises $1.57M
SociAbility has successfully raised $1.57 million in funding to enhance its platform which assists disabled individuals in locating accessible spaces. The funding will help improve the service by providing detailed and reliable accessibility information. Check it out: SociAbility
#Funding#Accessibility#SociAbility#DisabilitySupport#TechForGood#InclusiveDesign#Startup#Innovation#MobileApp#Investment
🚀 AI TRENDS | YouTube Introduces AI Avatar Tool for Shorts Creators
YouTube has launched a new AI avatar tool designed for Shorts creators, allowing them to generate videos of themselves using prompts. According to NS3.AI, this feature enables creators to produce clips lasting up to eight seconds. The rollout began on Wednesday and is accessible through the YouTube app and YouTube Create. Initially, the tool is available to mobile users worldwide, excluding Europe.
#AI#YouTube#AIAvatar#Shorts#ContentCreation#MobileApp#YouTubeCreate#AITrends#TechNews#CreatorTools
Gripp Secures $1.73M Funding
Gripp has successfully raised $1.73 million as of December 16, 2024. Their innovative QR + Mobile App system streamlines equipment maintenance, provides operational knowledge, and offers essential insights into operations.
#Funding#Gripp#MobileApp#EquipmentMaintenance#OperationalInsights#QRSystem#TechInnovation#Investment#Startup#Efficiency#BusinessSolutions