* Re: [gentoo-portage-dev] [PATCH] Use __future__ to enable floating-point division of integers in Python 2.
@ 2014-08-11 21:07 99% ` Michał Górny
0 siblings, 0 replies; 1+ results
From: Michał Górny @ 2014-08-11 21:07 UTC (permalink / raw
To: gentoo-portage-dev
[-- Attachment #1: Type: text/plain, Size: 776 bytes --]
Dnia 2014-08-11, o godz. 21:51:34
Michał Górny <mgorny@gentoo.org> napisał(a):
> In Python 2, the division ('/') operator defaults to integer
> (truncating) division when given integer argument. In Python 3, it
> performs floating-point division unconditionally instead. To overcome
> this difference and get a consistent behavior, integers were converted
> to floats explicitly in a few places.
>
> Instead, use a simpler 'from __future__ import division' statement that
> enables floating-point division globally in Python 2. Use it in all
> relevant files to get a consistent behavior, and use '//' appropriately
> whenever integer division is desired.
More specifically, this one's in git. Sorry for the extra thread.
--
Best regards,
Michał Górny
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 949 bytes --]
^ permalink raw reply [relevance 99%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2014-08-11 19:51 [gentoo-portage-dev] [PATCH] Use __future__ to enable floating-point division of integers in Python 2 Michał Górny
2014-08-11 21:07 99% ` Michał Górny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox