Ранее я уже упоминал о другой фишке из ˍˍ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
⚡️TapSwap Community: Major News Incoming Tomorrow!
#TapSwapBeta#SkillGaming#Web3Games
TapSwap Community announces a major update about their private beta launching tomorrow, featuring three exclusive skill-based games in Telegram. Limited spots are available, and interested participants should prepare to apply using a Google form link with their Telegram handle.
Source: link
@tonlines
TapSwap Community: Elevate Your Gaming Skills with Precision
#SkillGaming#TapToWin#ClassicWithCrypto
The TapSwap Community emphasizes skill and precision in classic games like Tetris, Solitaire, and Bubble Shooter. Players are encouraged to hone their focus and ability to outplay and earn, adding purpose to their gaming experience.
Source: link
@tonlines
🎮TapSwap officially launched the beta!
The project has made an important step forward — now skill games are available for the first testers directly in Telegram. Convenient format, fast loading and no unnecessary actions.
What's included in the beta:
• 🎯 Three games where the outcome depends on your skills
• 💰 Integration with $TAPS
• 📲 Access via Telegram mini-app
⚠️ At the current stage, only selected users have access to the beta.
If you are among them, you can already try out the platform before the official release.
🗓The public launch is scheduled for early June.
#TapSwap#БетаЗапуск#SkillGaming#Web3UA
Bot link:tapswap_bot📱
Nigeria Football Hub
🎮TapSwap officially launched the beta!
The project has made an important step forward — now skill games are available for the first testers directly in Telegram. Convenient format, fast loading and no unnecessary actions.
What's included in the beta:
• 🎯 Three games where the outcome depends on your skills
• 💰 Integration with $TAPS
• 📲 Access via Telegram mini-app
⚠️ At the current stage, only selected users have access to the beta.
If you are among them, you can already try out the platform before the official release.
🗓The public launch is scheduled for early June.
#TapSwap#БетаЗапуск#SkillGaming#Web3UA
Bot link:tapswap_bot📱
INSIDER USA 👉🏻 Subscribe