Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'float': 0.07; 'python3': 0.07; 'cc:addr:python-list': 0.11; '__future__': 0.16; 'directive': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'reproduce': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'feb': 0.22; '>>>': 0.22; 'import': 0.22; 'cc:addr:python.org': 0.22; 'integer': 0.24; 'cc:2**0': 0.24; '15,': 0.26; 'header:In- Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; '>>>>': 0.31; 'division': 0.31; 'subject:numbers': 0.31; 'received:google.com': 0.35; 'pm,': 0.38; 'changed': 0.39; 'frank': 0.68; 'divided': 0.91; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=QNUkxL3Dc3A6YaUStTK7YA/KZcFOrBUEE5woMsuQW8w=; b=Ph+2HeZC+/9tkDnXFSB3836r0ETo5AGyLUpGzWSyCnu+oL8dpaakLnOlxQY9Xgo551 CoQx8T3UC/4toLBhafbluwCLSdzrtUgzGZ/2ojSkavJ2eYBhhmXd2ReCAMqa+3qJw2av S2IHjcTbrfDUcSrAJ0Nyki/HUgIvbTRpSxMhEHBJQVDXWnmxFzTlsUAI9IzcQVPUhiN2 Alb1V7E+Dmqr9gGoe4fy84+EpLmoPTRHWBNfqrJf2cI/XSYp2cwx5eCAEOPcFNzh2G8X dYXK5nyUrnyw9pjLM9vwLt4t16si1DoJohBTfxrEJaIOCD96RC0YawdHy0it6QxwozaN uvUA== MIME-Version: 1.0 X-Received: by 10.68.162.66 with SMTP id xy2mr14621771pbb.46.1392459200488; Sat, 15 Feb 2014 02:13:20 -0800 (PST) In-Reply-To: References: <833583c7-c307-4ebf-9a60-3be146a565b5@googlegroups.com> Date: Sat, 15 Feb 2014 21:13:20 +1100 Subject: Re: decimal numbers From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1392459209 news.xs4all.nl 2895 [2001:888:2000:d::a6]:44728 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:66403 On Sat, Feb 15, 2014 at 9:04 PM, Frank Millman wrote: > If you are using python2, an integer divided by an integer always returns an > integer - > >>>> 10/3 > 3 > > It was changed in python3 to return a float - > >>>> 10/3 > 3.3333333333333335 > > You can reproduce the python3 behaviour in python2 by adding a 'future' > directive - > >>>> from __future__ import division >>>> 10/3 > 3.3333333333333335 > Conversely, you can get an integer result by using floor division: >>> 10//3 3 ChrisA