Ранее я уже упоминал о другой фишке из ˍˍ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
🪙SPIN & GET REAL CRYPTO
A new feature is live: Giveaways by MemeFi!💥
😵 Prize pool starts at $1,000,000!
How to win?
⭐️Spin the wheel
🔷 Hit the Ether icons
💯 Fill the Ether bar for a ticket to win $ETH!
The event kicks off today with a $25,000 prize pool. Each day brings new giveaways! 🥇
🔔Subscribe👉Join MemeFi
⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️
#memefi#spin#crypto
📣 Catizens! We are about to welcome the next update, includes:
Still worried about not being able to automatically buy the highest-grade airdrop cats? 📦
· The auto-buy function is coming soon! #Free your hands! 🚀
· At the same time, the offline #rewards have also been greatly advanced! This will make it easier for players to level up their cats, make #Catizen a real idle casual game! 😻
· Catizen has also adjusted the play experience of #SPIN(Increased randomness and reduced difficulty), don’t forget to try it again!
https:://t.me/catizenbot/👈
#crypto#ton#game
Spin (verb)/(noun)
Verb: to present information in a favorable or strategic way
Noun: a biased or strategic way of presenting information
Example (verb):
The government tried to spin the economic data as a success.
دولت تلاش کرد دادههای اقتصادی را بهگونهای ارائه کند که موفقیتآمیز به نظر برسد.
Example (noun):
The press secretary put a positive spin on the policy failure.
سخنگوی مطبوعاتی به شکست سیاست، تفسیر مثبتی داد.
Put a spin on : present something strategically
She put a positive spin on the election results.
او نتایج انتخابات را به شکل مثبتی تفسیر کرد.
Spin doctor : political advisor who manages public perception
The spin doctor tried to downplay the scandal.
مشاور سیاسی سعی کرد رسوایی را کماهمیت جلوه دهد.
#idioms
#discourseanalysis
#criticalthinking
#spin
#framing
#ielts#cae#fce