Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python.': 0.04; 'implements': 0.05; 'type,': 0.07; 'python': 0.08; 'received:209.85.214.174': 0.13; 'argument': 0.15; 'subject:() ': 0.16; 'subject:sum': 0.16; 'cc:addr:python-list': 0.16; 'language': 0.16; 'wrote:': 0.18; 'subject:not': 0.19; 'cc:no real name:2**0': 0.21; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'cc:2**0': 0.26; 'value.': 0.28; 'second': 0.28; 'pass': 0.29; 'message-id:@mail.gmail.com': 0.29; 'class': 0.29; 'cc:addr:python.org': 0.29; 'can.': 0.30; 'subject:number': 0.30; 'implement': 0.32; 'certain': 0.34; 'received:209.85.214': 0.36; 'received:google.com': 0.37; 'received:209.85': 0.38; 'should': 0.38; 'received:209': 0.39; 'type': 0.61; 'header:Received:6': 0.61; 'design': 0.61; 'details.': 0.69; 'buck': 0.84 Received-SPF: pass (google.com: domain of arnodel@gmail.com designates 10.182.85.103 as permitted sender) client-ip=10.182.85.103; Authentication-Results: mr.google.com; spf=pass (google.com: domain of arnodel@gmail.com designates 10.182.85.103 as permitted sender) smtp.mail=arnodel@gmail.com; dkim=pass header.i=arnodel@gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=UWtuv2U2Kt6yfYPoUtbaCbLFiinX8mq35aoaXlE2jfM=; b=eTcm4Z9Z5wZKBKc57FPHXzmKsqFTge2hM6zAnh9xanw2IpqKCrXoAZXRbhDsHOVz/N Yd1gKtl8kZ6h0QjvItili9ly/VT4B9ZNTLehTvKfpex6tp7eT+yMHv0J/hSgBm6vRzf4 PIslfqynIv9JKEYR64WEq579xI6kfWf+z2xPc= MIME-Version: 1.0 In-Reply-To: <91c71e41-b98c-46f6-b3af-bed894cf9d92@kh11g2000pbb.googlegroups.com> References: <91c71e41-b98c-46f6-b3af-bed894cf9d92@kh11g2000pbb.googlegroups.com> Date: Thu, 23 Feb 2012 21:32:43 +0000 Subject: Re: sum() requires number, not simply __add__ From: Arnaud Delobelle To: Buck Golemon Content-Type: text/plain; charset=UTF-8 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 13 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1330032766 news.xs4all.nl 6940 [2001:888:2000:d::a6]:42949 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:20750 On 23 February 2012 21:19, Buck Golemon wrote: > I feel like the design of sum() is inconsistent with other language > features of python. Often python doesn't require a specific type, only > that the type implement certain methods. > > Given a class that implements __add__ why should sum() not be able to > operate on that class? It can. You need to pass a second argument which will be the start value. Try help(sum) for details. -- Arnaud