Ранее я уже упоминал о другой фишке из ˍˍ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
Health workers,
Continuous and appropriate use of infection prevention and control methods is crucial to protect yourself from Healthcare-Associated Infections and further spread in the community.
🔗Download our National Guideline on #IPC for #VHF
https://ncdc.gov.ng/themes/common/docs/protocols/111_1579986179.pdf
Standard #IPC is key to preventing the spread of infection from patients to health workers, health workers to other health workers or their families, and from the patients to the rest of the community.
🔗Download our National Guideline on #IPC for #VHF
https://ncdc.gov.ng/themes/common/docs/protocols/111_1579986179.pdf
Health workers,
Continuous and appropriate use of infection prevention and control methods is crucial to protect yourself from Healthcare-Associated Infections and further spread in the community.
🔗Download our National Guideline on #IPC for #VHF
https://ncdc.gov.ng/themes/common/docs/protocols/111_1579986179.pdf
Viral hemorrhagic fevers #VHFs such as #LassaFever affect multiple organ systems in the body and may be accompanied by bleeding.
Download and share our National Guideline on #IPC for #VHF for measures required in the management of VHFs
🔗
https://ncdc.gov.ng/themes/common/docs/protocols/111_1579986179.pdf
Viral hemorrhagic fevers #VHFs are a group of infectious diseases that affect multiple organ systems in the body and may be accompanied by bleeding.
What are the #InfectionPreventionandControl practices that need to be in place in the management of VHFs?
🔗Download our National Guideline on #IPC for #VHF
https://ncdc.gov.ng/themes/common/docs/protocols/111_1579986179.pdf
Common Viral Haemorrhagic Fevers #VHFs include #LassaFever, #EbolaVirusDisease, #YellowFever, #DengueFever, #MarburgFever and #CrimeanCongoHaemorrhagicFever.
What are the #InfectionPreventionandControl practices that need to be in place in the management of VHFs?
🔗Download our National Guideline on #IPC for #VHF
https://ncdc.gov.ng/themes/common/docs/protocols/111_1579986179.pdf