Ранее я уже упоминал о другой фишке из ˍˍ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
🪐 In the spiral galaxy NGC 3310, astronomers have observed a rare "gamma-ray burst afterglow," the fading embers following one of the universe’s brightest explosions. This lingering glow, seen in visible light and X-rays, lets scientists track how shockwaves from the original burst plow through space, revealing clues about the powerful forces unleashed when massive stars die. ✨
#gamma-ray-bursts ⚡#strange-cosmic-phenomena ⚡#galaxies⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels
"Nunca habíamos visto nada igual..."
Algo aterrador está sucediendo en Estados Unidos (2025)
Únase a nosotros: https://anon.news
🔘En este video, el mundo quedó atónito ante la repentina aparición de un elegante monolito metálico en los remotos desiertos de Utah.
Alto y silencioso, el objeto guardaba un asombroso parecido con los monolitos de 2001: Odisea del Espacio, y luego, con la misma incógnita, desapareció.
Desde entonces, han aparecido docenas de estructuras similares en lugares de todo el mundo, desde las montañas nevadas de Rumania hasta las playas de California, las selvas de Colombia y los tejados de las ciudades europeas.
¿Son instalaciones artísticas, engaños elaborados o algo más enigmático?
Cada monolito parece surgir sin previo aviso, a menudo en lugares de difícil acceso, y sin que nadie se atribuya la responsabilidad.
Algunos son espejados y minimalistas; otros están grabados con símbolos crípticos.
El fenómeno ha desatado la intriga mundial, generando teorías de conspiración, videos virales y un auge en el debate especulativo sobre la vida extraterrestre, las sociedades secretas y la conciencia colectiva.
#unexplained#strange#phenomena
@EndTimesProductions@Jaymez
🪐 One of the most mysterious cosmic events are gamma-ray bursts, or GRBs—brief, intense flashes of high-energy light detected from distant galaxies, like the spiral galaxy NGC 2770. In 2008, NGC 2770 hosted the rare GRB 080319B, which was so bright that, for about 30 seconds, it was visible to the naked eye from Earth despite being 7.5 billion light-years away, making it the most distant object ever seen without a telescope. ✨
#gamma-ray-bursts ⚡#strange-phenomena ⚡#NGC2770⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels
🪐 In the star-forming region W51, astronomers have found “masers”—natural lasers made of microwaves—blasting out intense, focused beams from clouds of water and methanol molecules. These cosmic masers shine thousands of times brighter than any similar emission in our solar system and act like celestial signposts, marking areas where massive new stars are being born within dense, hidden clouds of gas. ✨
#strange⚡#phenomena⚡#maser⚡#starbirth⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels