Подразумеваемые неймспейсы или неявные пакеты.
Этот функционал добавлен в 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
🚀🚀 Storming Profits in the Premium Group
🎯🎯#DEEP/USDT has covered all the targets to give a profit 106% for all Premium Members
👁🗨Contact @futurechief to enter the Premium Futures & SPOT Group for daily gains
🚀🚀 123% Profit on #DEEP/USDT for our Premium Members on Binance Futures/Bybit/OKXX/Kucoin/Bitget
✅✅ All target completed
👁🗨Contact @primemod to enter the Premium Group for high quality SPOT & FUTURES Signals
Don't avoid the cliches - they always work because they are clichés.
In this post, you may face the author's offensive views about people's excessive repeated utterances that are widespread, calling attention to avert them. Basically, let it be on Instagram stories or Facebook profile pictures, you see people who post a picture of Yale, write Yale class of 2029 on the bio, and many similar actions.
Holders could have no issue with posting them, and they are entitled to publish anything they care to do unless they don't publish political statements that can be conceived as an opposing point. By talking with people who already know the ups and downs of US admissions and hearing things I wasn't aware of, I realized that getting into a TOP-20 school requires hard work: nighttime study sessions, countless drafts of the final masterpiece, and dreadful deadlines. But everyone, not just me, can sense that people ignore the pain of those mentioned above and end up somewhere else where they have no desire to pursue their 4-year life.
Rather than writing cool bio captions for NYU'28 or whichever college you dream of, spend time working on crucial components of the college application, check your essays to the expert, scrutinize what actions "99%" applicants are doing, and do the opposite or a bizarreness. My utterances may hurt souls, but I'm showing the truth (ridiculous actions).
Now, get off this app and finalize your college list, which you care less to do. Two months left to catch the golden fish!
#deep
#Deep Research #分享
分享:三款OpenAI Deep Research替代开源项目
https://github.com/nickscamara/open-deep-research
https://github.com/mshumer/OpenDeepResearcher
https://github.com/dzhng/deep-research
📢频道✈️群组☘️博客📬投稿
Happiness always look small while you hold it in your hands,
but let it go,
and you will learn at once
how big and precious it is.
– Maxim Gorky
#happiness#deep@quietworld🍃