Подразумеваемые неймспейсы или неявные пакеты.
Этот функционал добавлен в 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
#FARM/USDT analysis :
#FARM is currently in an uptrend, exhibiting a series of higher highs (HHs) and higher lows (HLs). The price is presently consolidating above the 200-period exponential moving average (EMA), and a bounce is anticipated, which would support the continuation of its bullish momentum. For a long entry, it is advisable to wait for a breakout above the $53 level to confirm the upward movement.
TF : 1H
Entry : $53.00
Target : $66.00
SL : $47.50
⚠️ Осторожно: после этого AMA может внезапно потянуть в #stake, #lend и #farm.
@bemofinance + @evaaprotocol + @bidask = 🔥
Увидимся завтра в 08:00 UTC! 👀
⚡️Electra meets you
The first DEX to trade perp assets directly from your wallet with high leverage, deep liquidity and the lowest fees.
Warm up with Bulls'n'Bears Game — pump $BTC to 1 billion, rack up points, and bring in more frens-electrons.
⭐️ More points mean bigger rewards!
⚡️Join Electra now!⏺
#TON#DEX#trade#farm#BTC
🤑Blum has released update — now we have the opportunity to create a tribe!
⚫️Go to tribe
⚫️ Every 8 hours we press “Claim”
⚫️ If possible, we spend tickets, because there was information that after a while they will expire
Also recently added the function of connecting a wallet and unlimited invites
♾
🛖Join our tribe and farm points for
💵 10% faster, as usual, let's try to reach the top together!
#blum#tribe#ton#farm
😸Farm $CATI on🎰🎰🎰
Today, 2 new farming pools with impressive prize pools appeared on the STON.fi exchange:
💎CATI/TON: 10,000 STON ($43,000)
🪙CATI/USDT: 10,000 STON ($43,000)
🗓 Farming will last until October 4. There is no blocking of LP tokens.
How to get rewards?
1. Top up the liquidity pool and receive your LP tokens
2. Click Farm on your liquidity pool
You can find detailed instructions here or watch our video guide📹
Farming is the process of earning rewards for providing your cryptocurrency as liquidity to decentralized finance platforms #DeFi.
#catizen#farm#stonfi#DEX#CATI
Raffle-airdrop $THNG from Drop Hunter and a mini-review of the token
😀 Things Token plans to launch an RWA platform for buying and selling real assets. It is hosted on our 🪙#TON blockchain and is already available on DEX platforms. You can learn more about the project.
The conditions for the #Airdrop are below:
🟡Launch the bot.
🟡Subscribe to the channel.
🟡Invite 5 friends (old referrals count).
🟡Buy 1 ticket and wait for the results to be announced.
Two-tier token system:
➖$THNGP: A token with voting rights in the DAO, mined through mining and participation in the presale. Can be exchanged for 👁#THNG at a ratio of 1:10. The transfer of this token is limited to a single transaction (for example, if you need to change your wallet). It can only be freely sent and received through mining, voting, and exchange (conversion) smart contracts. Do not attempt to sell these tokens or transfer them to exchanges.
😀$THNG: A freely tradable token for trading, transferring and other purposes.
🟡Drop type - Raffle.
🟡Total volume - 28 million $THNG coins
🟡Total winners - 400 people.
🟡For each user – $65,000 THNG for 1 ticket (50,000 points = 1 ticket)
😀 At the moment, THNG 2.0 staking is available with an APR of ~ 160% from August 23 to September 24.
🔥Keep farming and participate in all activities of DropHunters
#farm#drop#TON#web3