Подразумеваемые неймспейсы или неявные пакеты.
Этот функционал добавлен в Python 3.3
Что он означает?
Ранее, до 3.3 пакетами считались лишь директории, в которых есть файл __init__.py.
Этот файл одновременно являлся свидетельством того, что директория это Python-пакет, и служил "телом" этого пакета. То есть местом, где можно написать код, как это делается внутри модуля. Этот код исполняется в момент импорта пакета, так что его принято называть "код инициализации пакета".
Начиная с версии 3.3 Любая директория считается пакетом и Python будет пытаться использовать любую директорию для импорта.
Конечно, не любую в файловой системе, а только те что находятся в sys.path.
Это значит, что теперь __init__.py нужно делать только если:
🔸 вам требуется создать код инициализации пакета
🔸 нужна совместимость со старыми версиями Python
На мой взгляд это немного упрощает разработку, делает её чище, но с другой стороны убивает некоторую однозначность происходящего.
Например, я создал репозиторий со своей библиотекой и рядом положил код примеров или тестов.
repo_name/
my_library/
__init__.py
main.py
examples/
exam1.py
exam2.py
В этом репозитории пакетом является только my_library, остальные директории это не пакеты, это просто дополнительный код в файлах. Директория examples не добавлена в sys.path, в ней нет рабочих модулей. Но если она лежит рядом с my_library, то Python вполне сможет импортнуть из неё модули, так как посчитает что examples это валидный пакет.
Конечно, пример несколько надуманный. Никто не будет добавлять корень репозитория в sys.path. Но, я думаю, суть ясна. Иногда директория это просто директория а не пакет!
#basic#pep
Indian Delegation To Visit Russia For Next Round Of India-EAEU FTA Talks In June 2026 #Trade
🚨India, Russia-Led EAEU Bloc Had Launched Talks For An FTA On 26th November 2025
🚨The EAEU Comprises Of Russia, Kazakhstan, Armenia, Belarus, And Kyrgyzstan; With An Observer Status To Cuba, Moldova, And Uzbekistan
𝐀 𝐦𝐚𝐬𝐬𝐢𝐯𝐞 𝐰𝐢𝐧 𝐟𝐨𝐫 𝐈𝐧𝐝𝐢𝐚’𝐬 𝐞𝐱𝐩𝐨𝐫𝐭𝐞𝐫𝐬 🇮🇳🤝🇳🇿.
The India–New Zealand FTA signed today ensures 100% duty-free access across all tariff lines, eliminating earlier tariffs of up to 10% on textiles, leather, carpets, ceramics, and auto components, boosting competitiveness, cutting costs, and unlocking new markets. #Trade
Bangladesh to import 200 broad-gauge coaches from India by 2027
The project, financed by the European Investment Bank, is expected to see the coaches added to the Bangladesh Railway fleet between June 2026 and December 2027.
#trade
I’ve been on @Vault777Casino for a while now and it’s honestly one of the most engaging virtual trading platforms I’ve used to #trade
Fast predictions, leaderboards, rewards, and real strategy
⚡️ Storm Trade: Update Completed and New Features Announced
#TON#trade
The Storm Trade update has been completed successfully. The platform now uses the Pyth price feed protocol, offering faster and more accurate price updates. This upgrade enhances UI interaction and sets the stage for the upcoming V3 launch on TON.
Source: link
@tonlines
🇮🇳🤝🇰🇷 Looking forward to PM Modi visiting South Korea says SK President Lee Jae Myung
Indian Officials say an upgraded India-SK CEPA Agreement could be signed during the Visit.
2009 CEPA Agreement reduced Tariffs on 85% Indian Products to SK and 90% SK products to India
#Geopolitics#Trade
Trump sees resumption of trade with Russia as a guarantee of ending the conflict - Foreign Policy
In his policy of resolving the conflict in Ukraine, Donald Trump is betting to restore trade relations with Russia as the most important factor of peace. He argues that economic cooperation will benefit American investors and ensure stability in the region.
The US administration also believes that trade agreements with Russia, such as energy sector deals, can serve as a guarantor of peace.
#Trump#Russia#Trade
👂More on Trump's Ear
⚠️
Portals Community: Season 2 Launches with Points Farming
#Portals#trade
Portals Community announces the return of Points Farming with the launch of Season 2, allowing users to earn points and cashback on every trade. Users can enhance their progress by completing tasks, with more earning opportunities to come. Stay tuned for another major update arriving tomorrow.
Source: link
@tonlines