Ранее я уже упоминал о другой фишке из ˍˍ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
Excited to partner with @PublicAI_ to innovate in AI and blockchain!🤝
PublicAI leverages 800k verified contributors for premium AI training data. Backed by @solana and @NEARProtocol Foundation & Stanford Blockchain Accelerator, secured $11M business revenue. #UXLINK AI Growth Agent will elevate AI training data quality together. 🚀
#AIAgent#PublicAI#AGA
AI Ticket Assistants in Moscow Metro♐️
Moscow is taking another step toward a smart city future.
AI-powered virtual cashiers have appeared in several Moscow Metro stations. These assistants use voice recognition and natural dialogue to help passengers buy tickets — simulating real human conversation 🃏
Why it matters:
— Fast, friendly, and interactive ticketing
— Enhances accessibility for all users
— Blends everyday tech with a hint of AI charm
☁️Not exactly an art installation — but urban AI is definitely becoming part of the public experience.
#AI#SmartCity#MoscowMetro#UrbanTech#PublicAI
🔥 Bitget x PublicAI — CandyBomb Event ✅
💠Reward:Grab a share from1,142,000 $PUBLIC + 185,000 $PUBLIC for 650 random winners
☀️Join Now :- Click Here
⚙️How to Participate?
♦️Follow@bitgetglobal & @PublicAI_
♦️Quoterepost with #PUBLIClistBitget
♦️Submit your Bitget UID & X username
♦️Complete all tasks to receive rewards
📌About PublicAI:
PublicAI (PUBLIC) is officially listed on Bitget CandyBomb Trade or deposit to grab your share of over 1.1M $PUBLIC and join 650 lucky winners in the prize pool. 🚀
🚨 Tip:Early participation increases your winning chances act fast
® Note:This campaign is 100% free. No fees required. Please DYOR before participating.
#Bitget#PublicAI#CryptoAirdrop#CandyBomb#Giveaway