Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed4a.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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'operator': 0.03; 'syntax': 0.04; 'argument': 0.05; 'subject:Python': 0.06; 'assignment': 0.07; 'binary': 0.07; 'debugging': 0.07; 'incompatible': 0.07; '__name__': 0.09; 'correct,': 0.09; 'def': 0.12; 'attribute,': 0.16; 'before.': 0.16; 'expression.': 0.16; "function's": 0.16; 'lambda': 0.16; 'operator.': 0.16; 'operators,': 0.16; 'opposite': 0.16; 'ternary': 0.16; 'unlikely': 0.16; 'sat,': 0.16; 'all.': 0.16; 'wrote:': 0.18; 'variable': 0.18; 'replacing': 0.19; 'feb': 0.22; 'proposed': 0.22; 'propose': 0.24; 'replace': 0.24; 'order.': 0.26; 'van': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'appear': 0.29; 'statement': 0.30; 'message- id:@mail.gmail.com': 0.30; 'though.': 0.31; 'regular': 0.32; 'not.': 0.33; 'could': 0.34; 'received:209.85': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'doing': 0.36; 'useful': 0.36; 'wrong': 0.37; 'too': 0.37; 'two': 0.37; 'list': 0.37; 'received:209': 0.37; 'being': 0.38; 'mapping': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'does': 0.39; 'bad': 0.39; 'to:addr:python.org': 0.39; 'read': 0.60; 'associates': 0.60; 'name': 0.63; 'such': 0.63; 'more': 0.64; 'statement,': 0.68; 'subject:! ': 0.74; 'square': 0.74; 'gain': 0.79; '2015': 0.84; 'describes': 0.84; 'proposal.': 0.84; 'taken.': 0.84; 'albert': 0.91; 'thoroughly': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=GxIPBvQqtWNQXPZQ4IZK3/kD8nw7tiGJk6ZfGR+D96M=; b=D2XuKuEunL6+hKeD28782Dfu5mYFTEAEJtzMKpar/EMRm9ajvPM22etzXWrG8i8E6v LsvZ9fVjmzxmW8nN3ss4ZCWvio3EGziav8Y7I9PjBAV8PD8JRr35xo9htO1Ip332eeQk Zdf/9tCAv1jFBrsZHsAe5HQ7pPsoNgxwX0NIrlPzagz1lcs519eM8I3QXf6FUd6U9+bO JchB5Yd85MU0Q7r7J1vNvFESwMsC52Wdw6uhTpVWSOn6tYxtgsVlRn48vQQ6//33kCKy v4IYG4KbOl6hlKpdwjaoUtu/dDwbH+qhr2dSeTQyiydTnxQnf6X/Jlsfjk6IbYvxXV2S LEzA== X-Received: by 10.70.21.132 with SMTP id v4mr19289486pde.114.1423384349011; Sun, 08 Feb 2015 00:32:29 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <54d6b1a0$0$6917$e4fe514c@dreader36.news.xs4all.nl> References: <54c07d04$0$13012$c3e8da3$5496439d@news.astraweb.com> <54d6b1a0$0$6917$e4fe514c@dreader36.news.xs4all.nl> From: Ian Kelly Date: Sun, 8 Feb 2015 01:31:48 -0700 Subject: Re: Python is DOOMED! Again! To: Python 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: 52 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1423384358 news.xs4all.nl 2928 [2001:888:2000:d::a6]:41610 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:85354 On Sat, Feb 7, 2015 at 5:45 PM, Albert van der Horst wrote: > It is too bad `` -> '' as a token is now taken. > I wanted to propose to replace the ternary syntax > lambda .. : .. > by a regular operator > .. -> .. > then we could have > x -> x**2 > instead of > lambda x : x**2 Well, I don't think the existing syntax is incompatible with your proposal. As it is, the -> token can only appear after the argument list of a def statement, so there would be no grammatical ambiguity. I do think that such a proposal is unlikely to gain wide support though. > Moreover the value of a function would be a lambda > > not > def square(x): x**2 > but > square = x->x**2 This would be an anti-pattern. The def statement associates the name "square" with the function's __name__ attribute, which is useful for debugging and introspection. The proposed assignment statement does not. > mult = x,y -> > result = 0 > for i in range(x): > result +=y > return result I don't like this at all. I read "x -> x**2" as denoting a mapping from a bound variable to an expression. A whole function body just feels wrong here. > doing away with the ternary operator def def is a statement, not an operator. > replacing it by two binary operators, one of them (=) being thoroughly familiar. = is also not an operator. > Also name:str is the wrong order. I disagree; "name: type" is linguistically correct, with the colon denoting that what comes after describes what comes before. Without the colon, the opposite order would make more sense.