TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #205 · 22 јан.

Как работает функция reload()? Эта функция нужна для того, чтобы перезагрузить изменившийся код из py-файла без рестарта интерпретатора. Дело в том, что любой импортированный модуль при повторном импорте не будет перечитывать файл. Функция импорта вернёт уже загруженный в память объект модуля. Чтобы обновить код, нужно либо перезапустить всю программу, либо использовать функцию reload() from importlib import reload reload(my_module) 🔸 Функция reload() принимает в качестве аргумента только объект модуля или пакета. Она не может перезагрузить класс или функцию. Только весь файл целиком! 🔸 Перезагрузка пакета перезагрузит только его файл __init__.py, если он есть. Но не вложенные модули. 🔸Она не может перезагрузить ранее не импортированный модуль. 🔸При вызове функция reload() перечитывает и перекомпилирует код в файле, создавая новые объекты. После создания новых объектов перезаписывается ранее созданный неймспейс этого модуля. Это значит, что если где-то этот модуль импортирован через import и обращение к атрибутам происходит через неймспейс (имя) модуля, то такие атрибуты обновятся. Если какие-либо объекты из этого модуля импортированы через from то они будут ссылаться на старые объекты. Напишем простой модуль # mymodule.py x = 1 Теперь импортируем модуль и отдельно переменную х из модуля >>> import mymodule >>> from mymodule import x >>> print(mymodule.x) 1 >>> print(x) 1 Не перезапуская интерпретатор вносим изменения в модуль # mymodule.py x = 2 Делаем перезагрузку модуля и проверяем х ещё раз >>> reload(mymodule) >>> print(mymodule.x) 2 >>> print(x) 1 То же самое будет если присвоить любой объект переменной (даже словарь или список) Повторный импорт обновляет значение >>> from mymodule import x >>> print(x) 2 🔸Созданные инстансы классов не обновятся после перезагрузки модуля. Их придётся пересоздать. #tricks#basic

Резултати

Пронајдени 3 слични објави

Пребарај: #magicsquare

当前筛选 #magicsquare清除筛选
MoonPlay

@moonplay_official · Post #31 · 18.06.2024 г., 16:55

Boost Your Space Bucks with Missions! ✅ No time to explain - need more space bucks to get started with your ship upgrades? Head straight to the 👉Missionstab where new tasks pop up regularly to help you on your journey, and they’re your best bet to grab some extra Space Bucks. On top of Moonplaytasks (hope you’ve done them already), we’ve got 7 exclusive missions brought to you by Magic Square🤩 - easy actions that reward you with even more Space Bucks. Keep an eye on the Missions tab - more missions are coming your way to maximize your rewards! Stellar adventures start here:@moon_land_bot🚀 Website | Telegram Chat | X | Discord | Medium #ToTheMoon#MagicSquare#ecosystem#blockchain#gamefi#web3#wenlisting#airdropsoon#communityfirst#taptap#clicker#game

🏷 Start of presale from Fanton 🟡Placement will take place on August 7th at 11:00 UTC on the Magic Square platform 🟡Presale price – $0.023 (5% discount to the IDO price) 🟡Total raised amount – $150,000 🏆 We want to remind you that $FTON is a utility token for the Fanton Fantasy game, necessary for playing in project's tournaments. Token owners will be able to participate in staking and ⛏ farming, receive in-game bonuses, and also have exclusive right to purchase NFT cards of the project. The first part of FCFS/Whitelist Round: 🟨Create an account on Magic Square and go through KYC 🟨Use wallet which completed the Zealy campaign 🟨Click "Join Whitelist" Second part of the ProRata Round will begin on August 8th at 11:00 UTC. 📊 Allocation will depend on thr amount you contributed in relation to other participants. Trading with other users (until TGE) will appear on Magic Square OTC marketplace. More information in detailed guide - link here. #fanton#magicsquare#fton

⚡️Storm Trade, a Top DeFi Product, Ready to Launch Its Token The crypto market is currently going through a phase change: we see a shift in sentiment from memecoins to fundamental projects. Traders are less active in flying into no-name tokens that do not have strong products behind them. The latest launches of the TON ecosystem are not encouraging, the release of $HMSTR showed how quickly the situation on the market can change, bringing the end of the tap2earn era closer. And while clickers were taking money from the retail users, the development of DeFi projects continued. In the last 12 months, Perp DEXs have taken center stage in the web3 world. Derivatives trading volumes significantly exceed spot, by 2-10 times, and this figure continues to grow. New players are emerging. ⚡️ChainGPT IDO Starts October 14th IDO is taking place on the #ChainGPT launchpad, and the premarket on the TON network and on #MagicSquare confidently shows x3 from the initial presale price, which hints at buy pressure and a positive community mood. Only about 4% of the token will be allocated for the IDO. You already know that $STORM stakers will receive 30% of protocol fees, discounts on fees and additional goodies in the form of #DAO. And the token itself will participate in the liquidity buffer, participating in the constant buyback from the market. The ChainGPT IDO starts on October 14th, which means the listing will happen very soon, usually within a few days. In numbers: ⚡️Storm Trade generates from $5M to $40M per day ⚡️The platform rewards liquidity providers with most of the commissions ⚡️4M+ connected wallets What potential profit awaits holders? Let's look at an example: over the last 30 days, the platform has collected about $800k in fees (source: DefiLlama), which means that token stakers would have received ~$240k. According to tokenomics and unlocks, only about 20-30M tokens will be available for staking after the launch, and we get ~100% APR for the token price for the IDO. This is without taking into account the rate growth. While we watch how tapalki are launched and fade away, #StormTrade makes a real product that is already in a popular market segment, and the share of perps continues to grow. #DYOR and get ready to start: https://storm.tg/token #IDO#DEX#Perp#Web3#TON