Подразумеваемые неймспейсы или неявные пакеты.
Этот функционал добавлен в 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
🛎#FREESIGNAL
Make a LONG/BUY ORDER on #BTC/USDT from 80100 on Futures
Leverage - 5x - 10x - 25x - 50x
👁🗨Contact @cripexperts to enter the premium group & trade with perfect targets & stop loss levels
🚨#FREESIGNAL🚨
#BTC/USDT – LONG/BUY
📉 Entry: $92,400
📊 Leverage: 5x /10x /25x / 50x
📍Platform: Futures
🔥 This is a free trade idea — Premium members get full TP/SL levels and real-time updates!
💬 DM @cripexperts to join the Premium Group
✅ Trade smart. Trade with confidence.
🚨#FREESIGNAL🚨
#BTC/USDT – SHORT/SELL
📉 Entry: $91,350
📊 Leverage: 5x /10x /25x / 50x
📍Platform: Futures
🔥 This is a free trade idea — Premium members get full TP/SL levels and real-time updates!
💬 DM @cripexperts to join the Premium Group
✅ Trade smart. Trade with confidence.
🛎#FREESIGNAL
Make a LONG/BUY ORDER on #BTC/USDT from 80100 on Futures
Leverage - 5x - 10x - 25x - 50x
👁🗨Contact @primemod to enter the premium group & trade with perfect targets & stop loss levels
🛎#FREESIGNAL
Make a LONG/BUY ORDER on #BTC/USDT from 68640 on Futures
Leverage - 5x - 10x - 25x - 50x
👁🗨Contact @primemod to enter the premium group & trade with perfect targets & stop loss levels
🚨#FREESIGNAL🚨
#BTC/USDT – LONG/BUY
📉 Entry: $92,400
📊 Leverage: 5x /10x /25x / 50x
📍Platform: Futures
🔥 This is a free trade idea — Premium members get full TP/SL levels and real-time updates!
💬 DM @primemod to join the Premium Group
✅ Trade smart. Trade with confidence.
🚨#FREESIGNAL🚨
#BTC/USDT – SHORT/SELL
📉 Entry: $91,350
📊 Leverage: 5x /10x /25x / 50x
📍Platform: Futures
🔥 This is a free trade idea — Premium members get full TP/SL levels and real-time updates!
💬 DM @primemod to join the Premium Group
✅ Trade smart. Trade with confidence.
🔅BITCOIN Will Go Down From Resistance! Sell!📉
- - - - - - - -
Please, check our technical outlook for 📊BITCOIN.
The market is approaching a key horizontal level 78,161.73.
Considering the today's price action, probabilities will be high to see a movement to 77,165.90.
- - - - - - - -
#freesignal#bitcoin
- - - - - - - -
🌐Free Copy Trading: Link
📲Join VIP via Bot:Link
❓Official Contact:@signalprovidercontact
🔅BITCOIN Will Go Lower From Resistance! Sell!📉
- - - - - - - -
Please, check our technical outlook for 📊BITCOIN.
The market is trading around a solid horizontal structure 73,205.33.
The above observations make me that the market will inevitably achieve 68,619.32 level.
- - - - - - - -
#freesignal#bitcoin
- - - - - - - -
🌐Free Copy Trading: Link
📲Join VIP via Bot:Link
❓Official Contact:@signalprovidercontact
🔅BITCOIN Will Grow! Buy!📈
- - - - - - -
Here is our detailed technical review for 📊BITCOIN.
The market is on a crucial zone of demand 69,527.38.
The oversold market condition in a combination with key structure gives us a relatively strong bullish signal with goal 70,433.22 level.
- - - - - - - -
#freesignal#bitcoin
- - - - - - - -
🌐Free Copy Trading: Link
📲Join VIP via Bot:Link
❓Official Contact:@signalprovidercontact
🔅BITCOIN Will Go Up! Buy!📈
- - - - - - -
Here is our detailed technical review for 📊BITCOIN.
The price is testing a key support 69,833.99.
Current market trend & oversold RSI makes me think that buyers will push the price. I will anticipate a bullish movement at least to 71,850.50 level.
- - - - - - - -
#freesignal#bitcoin
- - - - - - - -
🌐Free Copy Trading: Link
📲Join VIP via Bot:Link
❓Official Contact:@signalprovidercontact
🔅BITCOIN Is Very Bearish! Sell!📉
- - - - - - - -
Please, check our technical outlook for 📊BITCOIN.
The market is trading around a solid horizontal structure 70,229.88.
The above observations make me that the market will inevitably achieve 69,008.56 level.
- - - - - - - -
#freesignal#bitcoin
- - - - - - - -
🌐Free Copy Trading: Link
📲Join VIP via Bot:Link
❓Official Contact:@signalprovidercontact