Ранее я уже упоминал о другой фишке из ˍˍ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
It's Mid-week!
We hope you're not relenting in your pursuit of success? Keep grinding and keep your eyes laser focused on your goals.
As you continue in the week, avoid distractions and only spend time doing things that add value to you.
Brace up, the week hasn't ended yet!
For Question, Information,Feedback ...
Kindly Contact
☎️T.me/FrxMaster_Gold
#PremiumVIP💯
#PropFirmChallenge&Verification✅
#FUNDEDAccountManagement👨🏻💻
JUST IN FOR VERIFICATION CHALLENGE ‼️
• Prop Firm - FTMO
• Challenge level - Phase 2
• Starting Balance - ($10,000)
• Current Balance - ($10,506.46)
• Target Profit - ($500 Growth)
• Profit - ($513.35)
• Floating Profits - ($0)
• Drawdown 3.47%
• Trading Period - (3 Days)
Interested Investors Should Share with us;
Platform:
Account ID:
Password:
Server Name:
Sign In Your Account Today For NEXT WEEK Trading.
Take a leap of faith and see your account grow consistently with us...Trust in our expertise. You surely won't be disappointed 👌
For Question, Information,Feedback ...
Kindly Contact
☎️T.me/FrxMaster_Gold
#PremiumVIP💯
#PropFirmChallenge&Verification✅
#FUNDEDAccountManagement👨🏻💻
JUST IN FOR VERIFICATION CHALLENGE ‼️
• Prop Firm - FTMO
• Challenge level - Phase 1
• Starting Balance - ($10,000)
• Current Balance - ($10,594.64)
• Target Profit - ($1k Growth)
• Profit - ($594.64)
• Floating Profits - ($78.7)
• Drawdown 0.47%
• Trading Period - (2 Days)
Interested Investors Should Share with us;
Platform:
Account ID:
Password:
Server Name:
Sign In Your Account Today For THIS WEEK Trading.
Take a leap of faith and see your account grow consistently with us...Trust in our expertise. You surely won't be disappointed 👌
For Question, Information,Feedback ...
Kindly Contact
☎️T.me/FrxMaster_Gold
#PremiumVIP💯
#PropFirmChallenge&Verification✅
#FUNDEDAccountManagement👨🏻💻