Ранее я уже упоминал о другой фишке из ˍˍ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
🗓December 3 marks the birthday of Huberte Rupert (1919–2005), a South African philanthropist and art enthusiast whose legacy shaped cultural and social development in the country. 🎨💛🇿🇦
She co-founded the Rupert Museum and supported numerous initiatives in education, healthcare, and the arts.
🖼 The Rupert Museum houses a remarkable collection of modern South African art from the 1940s to the early 2000s. It is located in Stellenbosch, just 50 km east of Cape Town.
Her husband, Anton Rupert, was a prominent South African businessman.
#SouthAfrica#Art#Culture#Philanthropy#HuberteRupert#RupertMuseum#Stellenbosch
🗓3 декабря – день рождения Хуберте Руперт (1919–2005), южноафриканской филантропки и ценительницы искусства, которая внесла огромный вклад в культурные и социальные проекты ЮАР. 🎨💛🇿🇦
Она стала соосновательницей Музея Руперта и поддержала множество инициатив в сфере образования, здравоохранения и искусства.
🖼Музей Руперта хранит впечатляющую коллекцию современного южноафриканского искусства 1940-х — начала 2000-х годов. Он расположен в Стелленбоше, в 50 км к востоку от Кейптауна.
Её муж, Антон Руперт, был известным южноафриканским бизнесменом.
#ЮАР#Искусство#Культура#Филантропия#HuberteRupert#RupertMuseum#Стелленбош#Руперт
🎂 October 4 — Birthday of Anton Edward Rupert (1916 – 2006), South African businessman, philanthropist, and conservationist.
🏛 Museums in South Africa connected to his legacy:
• Rupert Museum (Stellenbosch) — home to one of the most important private collections of 20th-century South African art, assembled by Rupert and his wife Huberte.
• La Motte Museum — located on the family’s wine estate, known for its collection of Pierneef works and Cape Dutch cultural heritage.
• Hester Rupert Art Museum (Graaff-Reinet) — named after Rupert’s mother, showcasing works of South African artists from the mid-20th century.
• Jan Rupert Art Centre (Graaff-Reinet) — a venue for rotating exhibitions under the Rupert Art Foundation.
• Franschhoek Motor Museum 🚗 — a world-class collection of automobiles, motorcycles, and bicycles spanning over 100 years of motoring history, founded by Rupert and later expanded by his son Johann.
🕊 Anton Rupert left a remarkable cultural and environmental legacy, bridging business, art, and nature conservation.
#AntonRupert#SouthAfrica#RupertMuseum#Art#Culture#Heritage#Philanthropy#MotorMuseum