Ранее я уже упоминал о другой фишке из ˍˍ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
$Dogs token is the governance token for Kennel.Ai platform
Web3 on chain platform Where pet dog breeders can tokenise pet dogs using NFT
Blockchain is the best way to decentralise dog data
Blockchain has created for pet dog breeders the opportunity to manage the industry themselves instead of having to pay and being governed by a centralised organisation
#DogData#FCI#DogBreeder#blockchain#Decentralised
$Dogs token is the governance token for Kennel.Ai platform
Web3 on chain platform Where pet dog breeders can tokenise pet dogs using NFT
Blockchain is the best way to decentralise dog data
Blockchain has created for pet dog breeders the opportunity to manage the industry themselves instead of having to pay and being governed by a centralised organisation
#DogData#FCI#DogBreeder#blockchain#Decentralised
Did you know Canine Corona Virus vaccination was discovered for Dogs 🐾 over 50 years ago
Has your dog had its Corona Virus vaccination ? ? ?
Kennel.Ai blockchain saved pet dog life data immutably
…building a decentralised system for storing dog life data without the need to pay international Kennel Clubs for paperwork
Developed by breeders , built by breeders , benefits dogs and saves pet dog owners money
Join Kennel.ai and start earning $DOGS tokens
https://kennel.ai/login
#dogs#dogdata#decentralised#KC#FCI
The original Safari Dog Show pet stroller…
A Cage
A Soft Crate
A Crate Trolley
A grooming table
All in one lightweight string guaranteed for three years product…
Direct from Sweden 🇸🇪
Delivery 7-10 days by courier
Cost ;
Medium 350 euro
Large 390 euro
Also home delivery with payment to driver is possible
https://kennel.ai/shop
Check out the Dog Blog to learn more about Pet Dogs …
https://kennel.ai/blogs
#Dogs#PetStroller#DogShows#DogShowTrolley#FCI
The original Safari Dog Show pet stroller…
A Cage
A Soft Crate
A Crate Trolley
A grooming table
All in one lightweight string guaranteed for three years product…
Direct from Sweden 🇸🇪
Delivery 7-10 days by courier
Cost ;
Medium 350 euro
Large 390 euro
Also home delivery with payment to driver is possible
https://kennel.ai/shop
Check out the Dog Blog to learn more about Pet Dogs …
https://kennel.ai/blogs
#Dogs#PetStroller#DogShows#DogShowTrolley#FCI