Подразумеваемые неймспейсы или неявные пакеты.
Этот функционал добавлен в 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
#NULS/USDT analysis :
#NULS is currently in a bearish trend, trading below the 200 EMA and consistently making new lows. The price is testing the 200 EMA, with expectations of a rejection at this level, which will lead to a continuation of the bearish momentum and the formation of new lows.
TF : 4h
Entry : $0.2760
Target : $0.2150
SL : $0.3145
#NULS/USDT analysis :
#NULS is currently in a downtrend, establishing lower lows (LLs) and lower highs (LHs) below the 200 EMA. The price has retraced to the resistance zone, and it is anticipated that it will continue its bearish momentum, potentially testing lower levels.
TF : 4h
Entry : $0.2996
Target : $0.2667
SL : $0.3230
#NULS/USDT analysis -
#NULS is trading in a downtrend below the 200 EMA. The price is currently declining from resistance zone and is expected to test the support zone soon.
TF : 1H
Entry : $0.3080
Target : $0.2840
SL : $0.3246
#NULS/USDT analysis -
#NULS is in an uptrend, trading above the 200 EMA. After the breakdown of the previous swing high, the price is now sustaining this level and is expected to continue its bullish momentum to test new highs.
TF : 30min
Entry : $0.3237
Target : $0.3479
SL : $0.3171
#NULS result
2 nd target achieved in just 2 days ✅✅
One more huge quick profit 32%🤑💰🤑
👉 Still thinking? The more you wait more you lose profit
☎️ Contact @MichaelStrategiesVip for membership and grab next breakout signal
#NULS result
1 st target achieved in just 6 house ✅✅✅
One more huge quick profit 6.3%🤑💰🤑
👉 Still thinking? The more you wait more you lose profit
☎️ Contact @MichaelStrategiesVip for membership and grab next breakout signal
#NULS result
1rd target achieved in just 16 house ✅✅✅
One more huge quick profit 5%🤑💰🤑
👉 Still thinking? The more you wait more you lose profit
☎️ Contact @MichaelStrategiesVip for premium membership and grab next breakout signal
📉 Today the market is in a slight correction. This is good for me.
Any price drop, I regard as an opportunity to buy cryptocurrency at a good price.
Today I add to my portfolio - NULS (#NULS).
Bought it for $ 10, on the largest crypto-exchange Binance.
🎯 Long term investment.
The Motive to buy:
#NULS is ranked 168 in the CoinMarketCap rating.
The coin was not pumped! The price has retested the support zone of $0.2125-0.3798 and moves to the resistance zone of $1.1065-1.3249.
To continue the growth, it is necessary to consolidate above $1.3250.
Price projector points to growth towards $2.15.
🚀 Expected to grow from 85% to 460%.
😱 You can see my previous investment result here - https://bit.ly/30GlvN2