Ранее я уже упоминал о другой фишке из ˍˍ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
Каскадерский трюк показал водитель автомобиля #Range#Rover на ул. Стеценко.
По предварительным данным, водитель двигался по ул. Стеценко, в какой-то момент потерял управление над своим железным конём и вылетел на тротуар, после чего влетел в трамплин из снега и въехал в воздухе в бигборд. К счастью никто в этом ДТП не пострадал. Водитель утверждает, что ехал с разрешённой скоростью
🌎 In 2014, NASA’s Mars rover Curiosity recorded unusual low-frequency sounds on the Red Planet. These noises, called "pressure fluctuations," are caused by Martian winds interacting with the planet’s thin atmosphere and ground. Scientists detected these signals using a special instrument known as REMS, and the data helps track daily weather changes on Mars. ✨
#Mars⚡#soundspace⚡#rover
👉subscribe Interesting Planet
👉more Channels
#cplusplus#arducopter#ardupilot#arduplane#ardurover#ardusub#autopilot#auv#copter#drone#dronekit#mavlink#plane#robotics#ros#rov#rover#sub#uas#uav#ugv
ArduPilot is a powerful and open-source autopilot system that can control many types of vehicles, including drones, planes, helicopters, and even submarines. It offers features like autonomous flight modes, programmable missions, and support for various sensors and communication systems. This system is highly reliable and customizable, making it beneficial for users who need advanced control over their vehicles. It also has a strong community and extensive documentation, which helps users learn and improve their projects.
https://github.com/ArduPilot/ardupilot