Ранее я уже упоминал о другой фишке из ˍˍ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
📑🖊 OPINION | Demonizing Nicolás Maduro: Fallacies and Consequences
In his latest opinion piece, Steve Ellner argues that saying 'I oppose sanctions' while criticizing the Maduro government’s policies as if they were separate issues is misleading. He stresses that sanctions and domestic policy are deeply interconnected, and that ignoring this relationship reinforces regime-change narratives and undermines international solidarity.
🔗 Read the full opinion piece here: https://shorturl.at/3J2tg
#NicolasMaduro#Sanctions#USSanctions
The fight over CITGO intensifies as the Delaware auction restarts amid low bids, creditor disputes, and parallel lawsuits. Behind the corporate scramble lies a deeper story of US sanctions and opposition mismanagement, threatening what Venezuela calls the ‘theft of the century.’
Watch the full video to learn more!
#venezuela#citgo#sanctions#ussanctions
US-sanctioned Chinese tanker passes Strait of Hormuz despite US blockade, data shows
[Read FullArticle]
@WorldNews#ChinaTanker#StraitOfHormuz#USSanctions
📝 INTERVIEW | Descendents of Cacique Ähuänumä: The 4F Huo̧ttö̧ja̧ Commune
In Venezuela’s Amazonas state, the February 4 Huo̧ttö̧ja̧ Commune brings together Indigenous governance and communal socialism. With collective land tenure and assembly-based decision-making, its people continue a tradition of resistance.
The Life Plan is central to their way of life. Integrating ancestral wisdom and modern education, it dictates when to plant, hunt, and harvest—ensuring harmony with nature.
🔗 Read the latest interview from VA’s Communal Resistance Series here: https://shorturl.at/B37yt
#CommunalandWorkingClassResistance#Communes#IndigenousPeoples#USSanctions
🚀 Iran Utilizes Cryptocurrency for Strait of Hormuz Passage Fees
Iran is employing cryptocurrency to collect fees from ships passing through the Strait of Hormuz. According to NS3.AI, TRM highlighted that the rapid nature of digital currency transactions and their operation outside the U.S. banking system complicate efforts by the U.S. to freeze or block these payments in real time.
#Iran#Cryptocurrency#StraitOfHormuz#DigitalCurrency#Shipping#USSanctions#Blockchain