Ранее я уже упоминал о другой фишке из ˍˍ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
🔥NEW RELEASE🔥
😁Forging the Guard: Wrestle Ups by Giancarlo Bodoni😁
➡️Giancarlo Bodoni, one of the most dominant grapplers on the planet and a top student of the legendary John Danaher, brings you a game-changing instructional designed to reframe how you think about reversals from the bottom.
➡️In Forging the Guard: Wrestle Ups, Giancarlo reveals how to seamlessly blend traditional BJJ guard positions with low-effort, high-reward wrestle ups—turning common situations into powerful sweeps and takedowns.
̶$̶1̶9̶7̶😍$14.99😍
❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️
📱Payment: 📱📱📱
💰Submeta FOR FREE
🌈UFC Picks
👑MasterClass
✈️@bjjfanaticsinstructionals
#GiancarloBodoni#WrestleUp#NoGi#NewWave
💁♀️Buy
💁♀️
😁Precision Sweeps And Wrestle Ups From The Seated Position By Shawn Melanson😁
➡️Master the art of disrupting standing passers with surgical precision. In his fourth and most dynamic instructional to date, best-selling BJJ coach Shawn Melanson delivers a comprehensive system for attacking from the seated guard — blending positional off-balancing, precision timing, and relentless wrestle-ups to systematically frustrate and dismantle your opponent’s passing game.
➡️Shut down standing passers with precision sweeps, wrestle-ups, and off-balancing tactics from seated guard in Shawn Melanson’s latest high-level BJJ instructional.
$79😍$9.99😍
❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️
📱Payment: 📱📱📱
💰Submeta FOR FREE
🌈UFC Picks
👑MasterClass
✈️@bjjfanaticsinstructionals
#ShawnMelanson#Sweeps#NoGi#WrestleUp
💁♀️Buy
💁♀️