Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsreader4.netcologne.de!news.netcologne.de!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.83.MISMATCH!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.028 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'subject:Python': 0.06; 'subject:Why': 0.09; 'python': 0.11; 'def': 0.12; '>>': 0.16; 'numpy': 0.16; 'types,': 0.16; 'wrote:': 0.18; '>': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; 'division': 0.31; 'received:google.com': 0.35; 'subject:?': 0.36; 'skip:& 10': 0.38; 'depends': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'rather': 0.38; 'to:addr:python.org': 0.39; 'ian': 0.60; '20,': 0.68; 'therefore': 0.72 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:to :content-type; bh=ykeD+ifNjaFvUHzu+M4G5wFm7xDhps29wVjdwtyeRJY=; b=wnN6TVqqDjIjj9GZTWQa5opLL3TQ2xya6qO7r0kTdw+Cu3wDFwQUna3nae4mJ21tlA CkFq4pWYEDK6r0FBbT2GXdTV00+OiuSMJRjTVcIfAbi3lP2sucBroyKUU2a5aVOVOy2O Xa6G/OaqWC/wsXnvariThtUUGWyY9YX+Lew4UnNrjX6GZWzoZcxvL9dKKUWkxOPZfQIy vnhUQDHiAzJg3Of7zued6X/vczt7ii0LjVCXdkZachWxDPhLltBerJ4rqKPN8ic2EMjy 61uuEiL8yOhavqlFoqg2JfxGO9EbjP8G+y68r1ugntaB6Y2P936as7OCDujKAy4WrRMw b+jA== MIME-Version: 1.0 X-Received: by 10.68.213.97 with SMTP id nr1mr34828231pbc.52.1398040145365; Sun, 20 Apr 2014 17:29:05 -0700 (PDT) In-Reply-To: References: <7x8ur1esa5.fsf@ruckus.brouhaha.com> Date: Sun, 20 Apr 2014 18:29:05 -0600 Subject: Re: Why Python 3? From: Ian Kelly To: Python Content-Type: multipart/alternative; boundary=e89a8ff1c0ea3f11c804f7829636 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: 47 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1398040148 news.xs4all.nl 2858 [2001:888:2000:d::a6]:33945 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:70448 --e89a8ff1c0ea3f11c804f7829636 Content-Type: text/plain; charset=UTF-8 On Apr 20, 2014 8:01 PM, "Gregory Ewing" wrote: > > Ian Kelly wrote: > >> def average(values): >> return sum(values) / len(values) >> >> This works for decimals, it works for fractions, it works for complex numbers, it works for numpy types, and in Python 3 it works for ints. > > > That depends on what you mean by "works". I would actually > find it rather disturbing if an average() function implicitly > used floor division when given all ints. The code above never uses floor division in Python 3. Therefore it "works". --e89a8ff1c0ea3f11c804f7829636 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


On Apr 20, 2014 8:01 PM, "Gregory Ewing" <greg.ewing@canterbury.ac.nz> wrote:
>
> Ian Kelly wrote:
>
>> def average(values):
>> =C2=A0 =C2=A0 return sum(values) / len(values)
>>
>> This works for decimals, it works for fractions, it works for comp= lex numbers, it works for numpy types, and in Python 3 it works for ints. >
>
> That depends on what you mean by "works". I would actually > find it rather disturbing if an average() function implicitly
> used floor division when given all ints.

The code above never uses floor division in Python 3.=C2=A0 = Therefore it "works".

--e89a8ff1c0ea3f11c804f7829636--