Подразумеваемые неймспейсы или неявные пакеты.
Этот функционал добавлен в 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 apologize for any inconvenience that may have been caused by the temporary disruption in service. We are committed to providing a seamless and secure experience for all of our users and appreciate your understanding during this time.
We are excited to introduce the bonus plan worth $10M as a token of gratitude for your patience and support. Details of the plan will be shared soon, and payouts will be processed next week. 👍❗️
Thank you once again for your trust in Wallet, and we look forward to continuing to provide you with a reliable and rewarding experience.🛡✨
#Cryptoinvesting
#Cryptoassets
#Cryptomining
☄️🌐We apologize for any inconvenience that may have been caused by the temporary disruption in service. We are committed to providing a seamless and secure experience for all of our users and appreciate your understanding during this time.
We are excited to introduce the bonus plan worth $10M as a token of gratitude for your patience and support. Details of the plan will be shared soon, and payouts will be processed next week. 👍❗️
Thank you once again for your trust in Wallet, and we look forward to continuing to provide you with a reliable and rewarding experience.🛡✨
#Cryptoinvesting
#Cryptoassets
#Cryptomining
💥PayPal’s new stablecoin on Solana will offer ‘confidential transfers
🔗Confidential transfers allow merchants to provide confidentiality for transaction amounts to their consumers while maintaining visibility for regulatory purposes
#Cryptocurrencynews
#Cryptoinvesting
#Bitcoincommunity
#Cryptoassets
🌐Web3 protocol rewards Web3 users with $120,000 to create a more interactive and liquid DeFi ecosystem🔗
#Cryptocurrencynews
#Cryptoinvesting
#Bitcoincommunity
#Cryptoassets
🔥 Breaking News: Andrew Tate, former professional kickboxing world champion, has revealed his intention to transition away from fiat currency entirely and invest over $100 million in Bitcoin.💸This move signals Tate's strong belief in the future potential of Bitcoin as a superior store of value compared to traditional currencies.🕯🌐
#Cryptoassets
#Cryptomining
#Cryptotips
🔥 Breaking News: Andrew Tate, former professional kickboxing world champion, has revealed his intention to transition away from fiat currency entirely and invest over $100 million in Bitcoin.💸This move signals Tate's strong belief in the future potential of Bitcoin as a superior store of value compared to traditional currencies.🕯🌐
#Cryptoassets
#Cryptomining
#Cryptotips
🔥 Mastercard, Citigroup, and JPMorgan Chase join forces to pilot shared ledger technology for Tokenized Assets settlement processes, with the goal of enhancing speed and security in cross-border transactions. This collaboration could transform the financial sector by enabling diverse asset types to settle on a unified platform.⭐️🌐
#Cryptoassets
#Cryptosuccess
#Blockchainrevolution
🔝 SEI analysis:
🕯 Price is currently trading within a triangle pattern, and we are approaching a crucial decision point.
✨The breakout of this triangle pattern will determine the next market movement.
🔄A breakout in the upward direction will likely push the price towards the next resistance area.
✔️Consider opening a small long position at the support area with a tight stop loss.
Support Area: $0.497-$0.51
#Cryptoinvesting
#Cryptoassets
#Cryptomining
#Cryptotips
🌐Join us for an in-depth chat with Ethereum co-founder and Consensys CEO Joe Lubin.
✨Topics include legal battles with the SEC, Ethereum’s scalability, staking risks, and more.
#Cryptoinvesting
#Cryptoassets
#Cryptomining
#Cryptotips