Ранее я уже упоминал о другой фишке из ˍˍ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
🔥$SHITCOIN
Entered this position as a speculative play within the SOLANA ecosystem. Monitor pullbacks carefully, manage entries with discipline, and always conduct your own due diligence before participating.
Telegram: https://t.me/shitcoin
X: https://x.com/shitcoin?s=21
Website: https://officalshitcoin.com/
🔗 Contract: https://solscan.io/token/9yWFUKC2TNzZs6e1PzGg4kLx9yYrqiTfoT1qcsNNpump
https://dexscreener.com/solana/GSLf2gBqPNHQMmMyzbG2V9qAYHZLrWCPxXSW9w1nrm4C
#SHITCOIN#Solana#SOL#TSLA#TESLACALLS
📍 List of abbreviations commonly used in cryptocurrency trading:
#ALTCOIN = Alternate cryptocurrency except bitcoin
#SHITCOIN = A coin with no potential value or use
#BEAR | #BEARISH = Negative price movement
#BULL | #BULLISH = Positive price movement
#LONG = Margin buy position
#SHORT = Margin sell position
#BTFD = Buy The Fucking Dip
#DILDO = Long green or red candles 😆
#DYOR = Do Your Own Research
#FA = Fundamental Analysis
#TA = Technical Analysis
#FOMO = Fear Of Missing Out
#JOMO = Joy Of Missing Out
#FUD = Fear Uncertainty & Doubt
#HODL = Hold a position
#MCAP = Market Capitalization
#MOON = Continuous upward movement of price
#OTC = Over The Counter
#PUMP = Upward price movement
#DUMP = To sell off a coin
#REKT = When you have a bad loss
#WHALE = Very wealthy trader/Market mover
#AMA = Ask me anything
#ATH = All Time High
#ATL = All Time Low
#DLT = Distributed ledger technology
#IMO = In My Opinion
#LAMBO = Lambo is symbol that becomes an elusive goal for most investors
#NOOB = A person who is inexperienced
#SAFU = Secure Asset Funds for Users
#SHILL = Holder of altcoin who just wants to promote it for his own benefit
✅@ElfCryptoVIP