Ранее я уже упоминал о другой фишке из ˍˍ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
🪙 32,137 #BTC ($2.18 billion) went from the wallet of the #Mt․Gox exchange that collapsed in 2014 to an unknown address — the market reacted with a drop, suggesting that payments to the exchange's creditors could begin at any moment.
⚫️The Black Swan arrived unexpectedly... wait for new comments, despite the unpleasant surprise, the situation may become an opportunity to enter the market and make money on non-negative growth.
😙 The reasons for the fall of the # bitcoin exchange rate below $61,000
The unemployment rate was 4.3%, which is higher than expected, indicating a possible recession
The Bank of Japan raised the interest rate for the first time in 17 years, which led to an outflow of investments from risky assets
Increased geopolitical tensions (fear of a major world war)
😏Continued distribution of #BTC from #Mt.Gox and #Genesis