Подразумеваемые неймспейсы или неявные пакеты.
Этот функционал добавлен в 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
🎧 Beyond the headlines on CDC vouchers and AI, how does #Budget2026 impact businesses, workers and you?
In a special episode of The Usual Place podcast, we have Second Minister for Finance Indranee Rajah, SMU assistant professor of political science Nathan Peng, and SG Tech co-chair of AI, Cloud and Data Chapter Gunasekharan Chellappan to help answer these questions. https://str.sg/pUiK
PM Lawrence Wong unveiled a range of support measures for Singaporeans in his #Budget2026 speech. https://str.sg/neqA
What was your favourite announcement?
🎧 More help for AI training, more support for lower-income families and just a little bit more CDC vouchers. But what does this year's #Budget2026 mean for us all?
This week on The Usual Place podcast, we chat with NUS political science lecturer Rebecca Grace Tan and SBF chief policy and operating officer Musa Fazal who help us make sense of it all. https://str.sg/siJV
#Budget2026: To discourage the consumption of tobacco products, PM Lawrence Wong said he will be imposing a 20% increase in tax on all such products from today. https://str.sg/y8jZ
#Budget2026: Eligible Singaporeans will receive a CPF top-up of up to $1,500, as part of measures to provide more support for seniors.
A new investment scheme will also be offered to CPF members. https://str.sg/BMhyP
#Budget2026: Singapore will be updating its foreign workforce policies to keep the country open to skills and expertise from foreigners, while ensuring Singaporeans remain at the centre core of the local workforce. https://str.sg/EG7k
#Budget2026: Singaporeans who go for selected AI training courses will get 6 months of free access to premium AI tools.
This is to allow them to practise, experiment, and apply what they have learnt. https://str.sg/JZGVx
#Budget2026: Singapore will establish a new National AI Council to provide strategic direction and drive the country’s AI agenda.
PM Lawrence Wong will chair this council. https://str.sg/4T5R9
https://x.com/priceactiongann/status/2017974249944932755?s=20
Nifty 50 very important levels are ahead
24355 to 23900
#StockMarketCrash is loading but not before the top cycle 27000 to 28000 completes and once it is done the one of the main cycles will take over on top.
#Budget2026
23900 was given months and highs were broken since then ranging on top and now retraced.
as long as the 23900 to 24355 holds and above that is clear upside only.
from there levels check for confirmations and once its clear and it forms lows here and it must hold there and price bounces nicely and goes up
long term cycle is 26525 and breaking that would be 27000 and next would be 28000 and will update once reached 27000.
bank nifty previous levels were 59860 and it's where the high was today almost exact it worked very well in nifty because of gift nifty in that cycle was complete and also bank nifty coincided
once this current upside is done it will all crash this year after highs around 28000 or so will update exact as price approaches near it.