Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #105943

Re: List of Functions

From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: List of Functions
Date 2016-03-29 14:33 +1100
Message-ID <mailman.125.1459222396.28225.python-list@python.org> (permalink)
References <3c44f0f8-d701-463e-bf2c-f5871c51bddf@googlegroups.com> <87bn5z1mkd.fsf@bsb.me.uk> <lf5d1qf2g7v.fsf@ling.helsinki.fi> <56f9c104$0$1604$c3e8da3$5496439d@news.astraweb.com> <87y492xaqh.fsf@bsb.me.uk>

Show all headers | View raw


On Tue, Mar 29, 2016 at 1:45 PM, Ben Bacarisse <ben.usenet@bsb.me.uk> wrote:
> If functions were defined
>
>   fun f(x): return x * x
>
> then an anonymous function could be written as a function definition but
> the name
>
>   fun (x): return x * x
>
> I suppose you could do that even with "def" but it's a bit less
> mnemonic.
>
> There's probably a good reason why this was not done -- maybe it stops
> the grammar being LL(1)?  And if lambda's arrived late, and a new
> keyword is needed to flag a function expression, then lambda is
> appealing to the designer since it's less likely to be in use as an
> identifier in existing code than many more meaningful keywords.

Some languages are exactly like this. I'm not sure what the reason is
for Python's difference, but one possibility is the mess that comes
from having statements inside expressions when indentation is
significant to statements (but free-form in expressions).

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

List of Functions Richard Riehle <rriehle@itu.edu> - 2016-03-27 12:38 -0700
  Re: List of Functions Erik <python@lucidity.plus.com> - 2016-03-28 00:10 +0100
  Re: List of Functions Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-28 01:19 +0100
    Re: List of Functions Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-03-28 10:51 +0300
      Re: List of Functions Marko Rauhamaa <marko@pacujo.net> - 2016-03-28 11:58 +0300
        Re: List of Functions Dan Sommers <dan@tombstonezero.net> - 2016-03-28 12:39 +0000
          Re: List of Functions Marko Rauhamaa <marko@pacujo.net> - 2016-03-28 16:40 +0300
            Re: List of Functions Chris Angelico <rosuav@gmail.com> - 2016-03-29 08:40 +1100
              Re: List of Functions Steven D'Aprano <steve@pearwood.info> - 2016-03-29 09:52 +1100
                Re: List of Functions Chris Angelico <rosuav@gmail.com> - 2016-03-29 10:40 +1100
                Re: List of Functions Marko Rauhamaa <marko@pacujo.net> - 2016-03-29 07:49 +0300
              Re: List of Functions Marko Rauhamaa <marko@pacujo.net> - 2016-03-29 07:45 +0300
                Re: List of Functions Chris Angelico <rosuav@gmail.com> - 2016-03-29 16:00 +1100
      Re: List of Functions Steven D'Aprano <steve@pearwood.info> - 2016-03-29 10:40 +1100
        Re: List of Functions Random832 <random832@fastmail.com> - 2016-03-28 19:50 -0400
        Re: List of Functions Chris Angelico <rosuav@gmail.com> - 2016-03-29 10:54 +1100
        Re: List of Functions Rustom Mody <rustompmody@gmail.com> - 2016-03-28 19:23 -0700
        Re: List of Functions Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-29 03:45 +0100
          Re: List of Functions Chris Angelico <rosuav@gmail.com> - 2016-03-29 14:33 +1100
          Re: List of Functions Rustom Mody <rustompmody@gmail.com> - 2016-03-28 23:21 -0700
            Re: List of Functions Marko Rauhamaa <marko@pacujo.net> - 2016-03-29 09:50 +0300
            Re: List of Functions Christian Gollwitzer <auriocus@gmx.de> - 2016-03-29 08:52 +0200

csiph-web