TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #61 · 2 апр.

Ранее я уже упоминал о другой фишке из ˍˍ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

Резултати

Пронајдени 3 слични објави

Пребарај: #neaofficer

当前筛选 #neaofficer清除筛选
NEA Singapore

@NEASingapore · Post #256 · 25.08.2021 г., 09:02

Hear from Mr JJ Simon about his whirlwind of a career over the 47 years at NEA. If you, like JJ, love the environment, want to help Singapore stay clean and vibrant, and are always looking for exciting challenges, consider joining us as an #NEAofficer. Listen here: https://youtu.be/Xrcyt21RXYc

Hashtags

NEA Singapore

@NEASingapore · Post #365 · 07.06.2022 г., 00:58

When #NEAOfficer Hamdan received a compliment from a resident for responding to his feedback on a Sunday, he was very surprised. Read on to find out why: https://www.facebook.com/NEASingapore/posts/344176487856773 #PeopleofNEA#NEA20

NEA Singapore

@NEASingapore · Post #357 · 24.05.2022 г., 01:03

What is the skill that our #NEAofficer, Sarmad, learnt at 16 years old that became useful when he turned 60? Read on to find out more: https://www.facebook.com/NEASingapore/posts/334885492119206 #PeopleofNEA#NEA20