Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed5.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.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'languages,': 0.03; 'python.': 0.04; 'parameter': 0.05; 'python': 0.08; 'notation.': 0.09; 'undefined': 0.09; 'def': 0.13; 'received:209.85.210.174': 0.13; 'received:mail-iy0-f174.google.com': 0.13; 'arg': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:syntax': 0.16; 'subtract': 0.16; 'syntax': 0.16; 'wrote:': 0.18; 'arguments': 0.18; 'dec': 0.22; 'header:In-Reply- To:1': 0.22; 'division': 0.23; "python's": 0.24; 'specify': 0.24; 'message-id:@mail.gmail.com': 0.28; 'print': 0.29; 'second': 0.29; 'pm,': 0.29; 'definition': 0.30; 'influenced': 0.30; 'yields': 0.30; 'does': 0.32; 'list': 0.32; 'tue,': 0.32; 'there': 0.33; 'match': 0.34; 'to:addr:python-list': 0.34; 'it.': 0.34; 'integer': 0.34; 'operations': 0.35; 'list.': 0.35; 'two': 0.37; 'received:google.com': 0.37; "there's": 0.37; 'could': 0.37; 'steven': 0.38; 'received:209.85': 0.38; 'easier': 0.38; 'should': 0.39; "it's": 0.40; 'received:209': 0.40; 'to:addr:python.org': 0.40; 'extremely': 0.40; 'happens': 0.40; 'huge': 0.61; '2011': 0.61; 'double': 0.61; 'imagine': 0.71; 'divided': 0.73; 'notion': 0.84; 'off"': 0.84; 'standard,': 0.84; 'sum': 0.89; 'things:': 0.91 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 :content-type:content-transfer-encoding; bh=IJKFwiKp/MTgJUU5Mbe3KdaLMTyd64+htfa0OChGsF4=; b=Em91kVkf2wzfhoJlrVf3kkUDZREQgQai4duap6oK6tttdLARHr92OI+i4ov01+/mXo JC/3K6b4rcahFH3KoxQwRRk46FmYQKf2V1j5K2y9MZuY2UNerMlRX6iJSHRAcIcFJgDj cSyx91IXW5CukP1ZKxgCbniuXB1wWE4Gh3RXg= MIME-Version: 1.0 In-Reply-To: <4ee6bbb3$0$11091$c3e8da3@news.astraweb.com> References: <4ee554a3$0$11091$c3e8da3@news.astraweb.com> <5de94e20-314e-4185-ba8f-75e54f87968e@d10g2000vbk.googlegroups.com> <4ee6bbb3$0$11091$c3e8da3@news.astraweb.com> Date: Tue, 13 Dec 2011 14:08:28 +1100 Subject: Re: Verbose and flexible args and kwargs syntax From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1323745713 news.xs4all.nl 6922 [2001:888:2000:d::a6]:35950 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:17103 On Tue, Dec 13, 2011 at 1:43 PM, Steven D'Aprano wrote: > It merely happens that C's > use of the notation % for the remainder operation likely influenced > Python's choice of the same notation. Considering that Python also had the notion that "integer divided by integer yields integer" until Py3, I would say it's extremely likely that most of Python's division facilities were modelled off C. That's not a bad thing; gives you a set of operations that a large number of people will grok, and only a small number of oddities. > I note that the *semantics* of the operation differs in the two > languages, as I understand that the behaviour of % with negative > arguments is left undefined by the C standard, while Python does specify > the behaviour. ... and there's the proof that "modelled off" does not mean "slavishly follows". This lack of definition is a weakness in C. > def foo(a, 2*b+1, c): =A0# double the second arg and add 1 No, that should subtract 1 from the second arg and halve it. The expression you give there has to match the value from the parameter list. This syntax would be a huge boon to Python. Imagine how much easier this could make things: def foo(sum(x)): return x print(foo(120)) # will print a list of numbers that sum to 120 ChrisA