Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] Use __future__ to enable floating-point division of integers in Python 2.
Date: Mon, 11 Aug 2014 21:06:48
Message-Id: 20140811230702.007dcd88@pomiot.lan
In Reply to: [gentoo-portage-dev] [PATCH] Use __future__ to enable floating-point division of integers in Python 2. by "Michał Górny"
1 Dnia 2014-08-11, o godz. 21:51:34
2 Michał Górny <mgorny@g.o> napisał(a):
3
4 > In Python 2, the division ('/') operator defaults to integer
5 > (truncating) division when given integer argument. In Python 3, it
6 > performs floating-point division unconditionally instead. To overcome
7 > this difference and get a consistent behavior, integers were converted
8 > to floats explicitly in a few places.
9 >
10 > Instead, use a simpler 'from __future__ import division' statement that
11 > enables floating-point division globally in Python 2. Use it in all
12 > relevant files to get a consistent behavior, and use '//' appropriately
13 > whenever integer division is desired.
14
15 More specifically, this one's in git. Sorry for the extra thread.
16
17 --
18 Best regards,
19 Michał Górny

Attachments

File name MIME type
signature.asc application/pgp-signature