Подразумеваемые неймспейсы или неявные пакеты.
Этот функционал добавлен в 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
⚡️Catizen Announcement: Animoca Invests in Catizen for Web3 Gaming Expansion
#Telegram#Bombie#Animoca
Animoca Brands has made a major investment in Catizen, a popular Telegram-based game with nearly 50 million players. With a significant community, Catizen is set to host the Bombie airdrop on May 20, 2025, expected to be one of the largest token generation events of the year.
Source: link
@tonlines
Insights on Crypto Developments
🚨 Important updates in the crypto sector:
1. Trump's Crypto Czar, David Sacks, hints at "important announcements" for digital assets soon.
2. KIP Protocol claims support for the LIBRA token by Argentina's president. Backed by Animoca Ventures and involved with the AI project *Open Campus*. Read more
3. Argentine President Mile clarifies his earlier tweet supporting a private startup, stating he lacked details at the time and has since deleted the post after further understanding. Read more
#Crypto#AI#VC#Animoca#Argentina#KIPProtocol#Trump#DigitalAssets#Milei#LIBRA#OpenCampus#Startup#Partnerships#Decentralization#Finance#Blockchain#Tech
🔥Blockchain Life 2024 — starts in a week!
The legendary Blockchain Life 2024 forum will be held in Dubai on October 22-23. 10,000+ participants will discuss strategies for earning on hot trends of autumn 2024.
🎙Speakers
Justin Sun - Founder of #TRON
Paolo Ardoino - CEO #Tether
Yat Siu - Co-Founder of #Animoca Brands
Pascal Gauthier - CEO #Ledger
Dr. Marwan Alzarouni - CEO of Dubai Blockchain Center
Xinxi Wang - Co-Founder of #Litecoin Foundation
Sunny Lu - CEO #Vechain
Arthur Breitman - Co-Founder of #Tezos
Eowyn Chen - CEO of #TrustWallet
🎓Forum program
The forum program includes keynote speakers, panel discussions, and master classes. You will be able to learn about the latest trends in the cryptocurrency sphere, innovative blockchain technologies, and effective trading strategies.
⚡️The exhibition will bring together leading mining companies providing equipment and services, as well as startups presenting their projects to investors.
⚡️Startup Pitch is a unique opportunity for startups to present their ideas to investors and funds.
⚡️Afterparty — a legendary event featuring a world-famous musician🎵Alan Walker, where you can connect with industry leaders in an informal setting.
👤Why should you go?
✔️ You will learn how to make money on cryptocurrencies and #Web3, regardless of which direction the market is moving.
✔️ You will hear inside information about what to invest in this fall and what is better to sell.
✔️ Traditionally, #BlockchainLife discusses cryptocurrency trends on average six months before they enter the masses.
✔️ All the industry leaders ( #Tether, #Tron, #TrustWallet, #Ledger, etc.) are coming to the forum, and you will be able to find the necessary contacts among the top community.
✔️ You will be able to communicate with the owners of cryptocurrencies that you have in your portfolio
📆When: October 22-23, 2024
📍Where: Festival Arena, Dubai, UAE
Registration:blockchain-life.com
You still can buy a ticket with 🛍 discount from our channel using the promo code: TONEVENTS
#TON#BTC#ETH#SOL#crypto#forum#networking
🪙October 22-23 — Blockchain Life 2024 in Dubai
The legendary Blockchain Life 2024 forum is returning to Dubai on October 22-23. As Dubai increasingly asserts itself as a global crypto hub, #BlockchainLife2024 will undoubtedly become the central crypto event of the year, gathering the top industry representatives from around the world in the crypto capital.
The bull cycle has already begun, but the long-awaited peak of growth is still ahead, so forum participants have a great opportunity to maximize their income.
More than 10,000 people from 120 countrieswill meet at the forum to explore new earning opportunities.
🎙Speakers
Justin Sun - Founder of #TRON
Paolo Ardoino - CEO #Tether
Yat Siu - Co-Founder of #Animoca Brands
Pascal Gauthier - CEO #Ledger
Dr. Marwan Alzarouni - CEO of #Dubai Blockchain Center
Xinxi Wang - Co-Founder of #Litecoin Foundation
Sunny Lu - CEO #Vechain
Arthur Breitman - Co-Founder of #Tezos
Eowyn Chen - CEO of #TrustWallet
Sasha Plotvinov - Founder of #Notcoin💎
🎓Forum program
The forum program includes keynote speakers, panel discussions, and master classes. You will be able to learn about the latest trends in the cryptocurrency sphere, innovative blockchain technologies, and effective trading strategies.
⚡️The exhibition will bring together leading mining companies providing equipment and services, as well as startups presenting their projects to investors.
⚡️Startup Pitch is a unique opportunity for startups to present their ideas to investors and funds.
⚡️Afterparty — a legendary event featuring a world-famous musician🎵Alan Walker , where you can connect with industry leaders in an informal setting.
📆When: October 22-23, 2024
📍Where: Festival Arena, Dubai, UAE
Registration:blockchain-life.com
🎫Buy your ticket now at the lowest presale price with promo codeTONEVENTS👉
#BTC#TON#ETH#conference#blockchain#forum#networking