Подразумеваемые неймспейсы или неявные пакеты.
Этот функционал добавлен в 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
We are thrilled to announce that certain unlocked tokens from the excellent projects invested by UFLY Labs will be shared to UXLINK Season 2 stakers. We share values with community, as promised, as always.
The co-promotion and empowerment between UFLY Labs and #UXLINK ecosystems have given UFLY Labs an extraordinary start in 2025! We must learn from the industry leaders #BNB#BGB#GT and benefit $UXLINK holders. No doubt that a strong and lasting community is the only shortcut to make the UFLY evergreen.
Keep building!🫡
🚀Bitget Wallet Contest Week has begun!
The project team has prepared many events for us with prizes in $TRUMP, #USDT, $BGB and KeyShards tokens.
All week from January 20 to January 26, complete tasks to receive drops from participant projects🌟
Launch 💙Bitget Wallet Lite directly in Telegram to get these incredible prizes! 🎉
#Trump#BGB#BitgetWallet
💙Bitget Wallet Launches a New Era of Web3 Payments
Bitget Wallet has announced its 2025 strategy, focusing on the concept of #PayFi. This is a real breakthrough in the world of crypto payments, which turns passive Web3 investments into an active financial instrument for everyday use.
📊Integration of earnings, expenses and transfers
With over 60 million users worldwide, Bitget Wallet is redefining the role of cryptocurrency in personal finance. The PayFi system allows users to earn, spend, and send cryptocurrency in a single ecosystem, making it as useful as possible in everyday life.
✈️PayFi Flywheel Model
The strategy is based on the PayFi Flywheel model, which transforms the traditional crypto wallet from a simple storage tool into a full-fledged financial hub. Users will be able to deposit assets, such as stablecoins, into savings accounts with real income, which are immediately used to cover daily expenses under the concept of “buy now, pay later.”
💳Launch of Bitget Wallet Card
Key new products include the Bitget Wallet crypto card, which is supported by
💳Mastercard. This card will be linked to a multi-currency, crypto-friendly international bank account, greatly expanding the possibilities for using your crypto assets in real life. In addition to the card, users will have access to an in-app section for online shopping thanks to partnerships with companies like #Bitrefill, #IvendPay and #Coinpal.
🗺Supporting growing markets
The significant growth in users in Africa, the Middle East and Latin America (over 1000% in 2024) highlights Bitget Wallet's commitment to making cryptocurrency accessible to everyone, especially those who have been left out of the traditional banking system.
Alvin Kahn, COO of Bitget Wallet:
This is not just a product — it is a movement that will make cryptocurrency a viable financial instrument for billions of people. We integrate blockchain technology into everyday life, creating a new paradigm for personal finance.
💰How to leverage it?
It is assumed that settlements will be made through $BGB, the holders of which will become the beneficiaries of the new direction of the exchange. If you use Bitget Wallet Lite to collect KeyShards, which will probably also be converted to $BGB — you can easily migrate to Bitget Wallet by importing a seed phrase or private key and get all the benefits of PayFi Flywheel.
#BitgetWallet#Web3#DeFi#BGB