Ранее я уже упоминал о другой фишке из ˍˍfutureˍˍ , это оператор деления.
from __future__ import division
Суть проста. Раньше сложность типа данных результата поределялась типом самого сложного операнда.
Например:
int/int => int
int/float => float
В первом случае оба операнда int, значит и результат будет int. Во втором float более сложный тип, поэтому результат будет float.
Если нам требуется получить дробное значение при делении двух int то приходилось форсированно один из операндов конверировать в float.
12/float(5) => float
Но с новой "философией" это не требуется. В Python3 "floor division" заменили на "true division" а старый способ теперь работает через оператор "//".
>>> 3/2
1.5
>>> 3//2
1
То есть теперь деление int на int даёт float если результат не целое число.
В классах теперь доступны методы __floordiv__() и __truediv__() для определения поведения с этими операторами.
Данный переход описан в PEP238.
#pep#2to3#basic
💥Brand new alpha version of #Cetus is NOW LIVE on #Sui Devnet!!
🫱Access our latest application via https://app.cetus.zone
#DeFi#AMM#CLMM
https://twitter.com/CetusProtocol/status/1592871290599542785?s=20&t=THmh2WKC7kM7X0PfXpqjEQ
@everyone
Today we explore how TONCO — the first DEX with concentrated liquidity on 🤑 TON — lets you earn high yields from liquidity pools.
📹Check this video!
Dive into DeFi and start earning!
🪙
#Web3#Crypto#DeFi#DEX#LiquidityPools#AMM#TONCO
After the horse , what comes next?
yes , a Cow
New farm on #TAPSWAP OASIS pool, A single asset staking where you can stake $BIFI and earn $TAPS!
Check it out!✍️
https://dapp.tapswap.money/#/pools
#HotDeFiSummer#BSC#AMM#YieldFarming#ApeSwap
📌GPT360 is excited to announce its new media partners, who will also be integrating our protocol into their community!
📌FamSwap, A #Web3 one-stop decentralized trading platform including #AMM, #MiningPool, #LaunchPad , #Game, #NFT and #AIGC
Bitcoin Whales Buy the Dip!
Bitcoin whales are buying during the price dip. Circle CEO Jeremy Allaire advocates for U.S. regulation of stablecoins, insisting companies must register if offering dollar-backed stablecoins in the U.S. PayPal plans to integrate its stablecoin PYUSD into various products, aiming for global payments via Hyperwallet in 2025. Pump.fun is launching its own AMM and leaving Raydium.
Read more on Circle's stance here.
For PayPal's integration plans, click here.
Details about Pump.fun's move can be found here.
#Bitcoin#Stablecoin#Regulation#Circle#PayPal#PYUSD#DeFi#Crypto#AMM#Raydium#Finance#ConsumerProtection#Blockchain#Payments#MarketTrends#Investment#TechNews#VC