Ранее я уже упоминал о другой фишке из ˍˍ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
#selfimprovement
Emotional Intelligence: Why It Matters More Than IQ🧠
You’re not as rational as you think you are. None of us are. Neuroscience shows that our amygdala, the brain’s emotional center, often fires before the prefrontal cortex—our logical HQ—has even had time to weigh in.
Finally reached 300 members
Thank you so much for all your wonderful support 😊😍
#300Members#ipersonalgrowths
#selfimprovement#Mentorship
PS : Once Again Thanks all dear Amazing people 🌻🌿 Let's go ahead 😀 fulfill You're Dream and Ambitious
Stay Connect 🌼💫 Keep Supporting 💛
As you may have noticed one month into the new year, traditional New Year’s resolutions often fail because people set vague or too big goals, rely only on willpower, and don’t have a clear plan. Small, specific changes and building habits step by step are supposed to work better. 🔄
[Read more]
@googlefactss
#NewYearsResolutions#Habits#Goals#SelfImprovement
The Power of Your Thoughts - #stoicismquotes#powerofthought#selfimprovement#motivationalspeech
https://t.me/LanguageStuff
Learning should be easy and enjoyable 😎👍
Rich Dad vs Poor Dad mindset 💸
Poor Dad: “Money comes when you work.”
Rich Dad: “Money comes when you build a system.”
The lesson:
Don’t only trade time for money.
Build assets, skills, and processes that pay you repeatedly.
Today’s action:
Pick ONE system to start:
• automate savings/investing
• create a digital product
• build a side business workflow
#RichDadPoorDad#money#wealth#mindset#financialfreedom#selfimprovement#books
How to Get Ahead of 99% of People (Starting Today)
2023-03-20 by Mark Manson
#markmanson#markmanson#selfimprovement#howtochangeyourlife#betterideas#selfimprovementtips#selfimprovementbooks
#YouTube#liked