Ранее я уже упоминал о другой фишке из ˍˍ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
The Daily Gwei (🔗YouTube)
🔗ETH infinite bid, Ethereum's next 10 years and more - The Daily Gwei Refuel #845 - Ethereum Updates
Subscribe to the newsletter: https://thedailygwei.substack.com
Follow me on Twitter: https://twitter.com/sassal0x
Follow The Daily Gwei on Twitter: https://twitter.com/thedailygwei and https://twitter.com/DailyGwei_TV
Join the Discord channel: https://discord.gg/4pfUJsENcg
--------------------------------------------------
The Daily Gwei Refuel gives you a recap every week day on everything that happened in the Ethereum and crypto ecosystems over the previous 24 hours - hosted by Anthony Sassano.
--------------------------------------------------
Timestamps and links 👇
00:00 Introductory song
https://x.com/sassal0x/status/1955246612789465572
01:40 ETH treasury companies on fire
https://x.com/SERdotxyz/status/1955458142977810600
17:14 The ETH ETFs seeing record flows
https://x.com/sassal0x/status/1955461999862878368
23:21 The SEC's...
View original post
~
₿izFeed#⃣:#daily
OKX XP Marathon - S3
Run the long game 🏃🏻♀️🏃🏻♀️🏃🏻♀️
Prize:
250 USDT waiting for you to win!
🥇 1st : 60 USDT
🥈 2nd : 50 USDT
🥉 3rd : 40 USDT
🎁 4th : 30 USDT
🎁 5th : 20 USDT
🎁 6th–10th : 10 USDT each
How to earn points👇
1. Sign up on OKX (If you haven’t already)
2. Join & stay in OKX Global Discord (Must)
3. Chat actively in #general-chat to earn XP🏆 and use the hashtag # XPMarathonS3
4. Valid messages only (No spam, No links)
5. Send 'Win XP' to #daily-check-in to earn extra points 👉 100xp
6. Submit this Form for reward distribution
📆 Event Period: 4/2/2025, 9:30 AM - 13/2/2026, 6:00 PM (GMT+8)
👇
Join now
Our Socials:
⚜️Sign Up on OKX | Join Affiliate | TG | DC | Wallet TG | Wallet Announcement | OKX on Spotify | Twitter/X | YouTube
⭐️CN DC | CN TG
‼️Please check the authenticity of all OKX links or channels at OKX channel verification