Ранее я уже упоминал о другой фишке из ˍˍ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
⚡ Компания Lightning Labs представила инструменты LangChainBitcoin, которые позволят ИИ-разработчикам интегрировать биткоин-платежи в свои решения.
«Инструменты построены на протоколе L402, собственном механизме аутентификации Lightning Network, и Langchain, популярной библиотеке для упрощения работы с агентами ИИ», — говорится в описании.
LangChainBitcoin позволяет непосредственно взаимодействовать с биткоином, хранить баланс, отправлять и получать криптовалюту через сеть микроплатежей, а также напрямую управлять нодой LND, подчеркнули разработчики Lightning Labs.
#AI#Lightning
🌎 Lightning can sculpt glassy roots in sand! When a lightning bolt strikes the beach, it melts the grains into branching tubes called fulgurites—nature’s underground lightning “fossils.” ✨
#lightning⚡#geology⚡#minerals
👉subscribe Interesting Planet
OpenRGB
Open source #RGB#lightning control
If you have RGB devices from many different manufacturers, you will likely have many different programs installed to control all of your devices. These programs do not sync with each other, and they all compete for your system resources. OpenRGB aims to replace every single piece of proprietary RGB software with one lightweight app.
https://openrgb.org
#ChatGPT easily writes the code of a reverse proxy that allows you to open the API gate for payments #Bitcoin#Lightning and just as easily translates this code into the popular Rust programming language
Simply put, machines are capable of making transactions with other machines 😈
🌎 A bolt from the past—fossilized lightning! When a lightning strike fuses sandy soil, it creates glassy, branching tubes called fulgurites, preserving the path of electricity underground for thousands of years. ✨
#geology⚡#lightning⚡#fossils
👉subscribe Interesting Planet
🌍 A single lightning bolt can be five times hotter than the surface of the Sun. These powerful flashes quickly heat the air, causing the thunderous sound we hear soon after. ✨
#weather⚡#lightning⚡#atmosphere⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography🌍