Ранее я уже упоминал о другой фишке из ˍˍ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
🍿 Government Cheese: Apple TV+ Goes Full Surreal with This Wild Comedy
📆Premiere: April 16, 2025
🎭Genre: #Comedy · #Surreal
David Oyelowo (‘Selma’, ‘Nightingale’) leads Government Cheese, a wild, satirical take on the American Dream. Set in 1969, the show follows Hampton Chambers, a con man fresh out of prison who returns to his family with big dreams—only to find they’ve moved on without him. His grand plan? A bizarre invention, a pile of debt, and a “righteous path” full of chaos.
Think Fargo meets Wes Anderson, but with a fresh, Black-led perspective. Apple TV+ is leaning hard into quirky crime comedies, and this one, with Pharrell Williams on the soundtrack, feels like a bold, must-watch gamble 🎶🔥. Will it be a cult classic or just a wild experiment? We’ll find out soon.