Ранее я уже упоминал о другой фишке из ˍˍ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
#ERN/USDT analysis :
#ERN is currently in an uptrend, trading above the 200 Exponential Moving Average (EMA). The price has recently bounced back and broken out above the trendline, suggesting a potential continuation of the uptrend. The price is anticipated to move upside and test the swing high level.
TF : 30min
Entry : $1.704
Target : $1.992
SL : $1.620
#ERN/USDT analysis :
#ERN is currently in a bearish trend, characterized by a series of lower lows (LLs) and lower highs (LHs) while adhering to the trendline. The price is anticipated to continue this direction, testing lower levels in the near future.
TF : 1D
Entry : $2.230
Target : $1.610
SL : $2.608
#ERN/USDT analysis :
#ERN has broken out above the 200 EMA and is currently consolidating above it. The price is expected to sustain its bullish momentum and is likely to continue its upward trajectory.
TF : 4h
Entry : $2.277
Target : $2.554
SL : $2.088