Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #76773
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | alex23 <wuwei23@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: proposed syntax for multiline anony-functions (hopefully?) |
| Date | Fri, 22 Aug 2014 15:15:32 +1000 |
| Organization | A noiseless patient Spider |
| Lines | 32 |
| Message-ID | <lt6jlm$ddd$1@dont-email.me> (permalink) |
| References | <1bd05b41-ad00-4ce8-8678-de51205ebc3b@googlegroups.com> <913e5a30-f89b-4e94-afb4-b3d302ed44ac@googlegroups.com> <871tsajiqb.fsf@elektro.pacujo.net> <e49beff9-866b-4785-94fa-16122f9a8c1a@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Fri, 22 Aug 2014 05:15:34 +0000 (UTC) |
| Injection-Info | mx05.eternal-september.org; posting-host="f141bde4d1e4edae3516bb9f1d8e176c"; logging-data="13741"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+jfXELHF05MgqxmsYqVzTS" |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 |
| In-Reply-To | <e49beff9-866b-4785-94fa-16122f9a8c1a@googlegroups.com> |
| Cancel-Lock | sha1:9i8ho8FUcvcVGn9JV/NQj80s9+4= |
| Xref | csiph.com comp.lang.python:76773 |
Show key headers only | View raw
On 21/08/2014 7:30 PM, icefapper@gmail.com wrote:
> On Thursday, August 21, 2014 2:27:08 AM UTC-7, Marko Rauhamaa wrote:
>> In practice, your proposal would not make life easier for Python
>> programmers.
>
> neither did the lambda, yours truly supposes?
alex23 disagrees. alex23 finds the lambda extremely convenient for
things like sort, filter etc where alex23 wants to provide a function.
alex23 finds this to be very readable:
odds_list = filter(lambda x: bool(x % 2), some_list)
By comparison, alex23 finds this to be more cumbersome for little gain:
def odds_only(x):
return bool(x % 2)
odds_list = filter(odds_only, some_list)
alex23 finds most examples for multiline anonymous functions to be far
more difficult to parse than the both restricted lambda form and the
separate function approach:
odds_list = filter((def(x):
return bool(x % 2)), some_list)
alex23 isn't even sure if that's the correct format for your proposed
syntax, or whether `, some_list)` has to appear on a separate line, or
even if the () around the anonymous function is even necessary (alex23
assumed it was from your description of the closing parenthesis popping
the "space-sensitivity-stack").
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
proposed syntax for multiline anony-functions (hopefully?) icefapper@gmail.com - 2014-08-21 00:55 -0700
Re: proposed syntax for multiline anony-functions (hopefully?) Chris Angelico <rosuav@gmail.com> - 2014-08-21 18:18 +1000
Re: proposed syntax for multiline anony-functions (hopefully?) icefapper@gmail.com - 2014-08-21 01:59 -0700
Re: proposed syntax for multiline anony-functions (hopefully?) Chris Angelico <rosuav@gmail.com> - 2014-08-21 19:05 +1000
Re: proposed syntax for multiline anony-functions (hopefully?) icefapper@gmail.com - 2014-08-21 02:06 -0700
Re: proposed syntax for multiline anony-functions (hopefully?) icefapper@gmail.com - 2014-08-21 02:27 -0700
Re: proposed syntax for multiline anony-functions (hopefully?) icefapper@gmail.com - 2014-08-21 02:14 -0700
Re: proposed syntax for multiline anony-functions (hopefully?) Marko Rauhamaa <marko@pacujo.net> - 2014-08-21 12:27 +0300
Re: proposed syntax for multiline anony-functions (hopefully?) icefapper@gmail.com - 2014-08-21 02:30 -0700
Re: proposed syntax for multiline anony-functions (hopefully?) alex23 <wuwei23@gmail.com> - 2014-08-22 15:15 +1000
Re: proposed syntax for multiline anony-functions (hopefully?) Terry Reedy <tjreedy@udel.edu> - 2014-08-21 06:07 -0400
Re: proposed syntax for multiline anony-functions (hopefully?) Travis Griggs <travisgriggs@gmail.com> - 2014-08-22 13:05 -0700
Re: proposed syntax for multiline anony-functions (hopefully?) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-23 19:20 +1000
Re: proposed syntax for multiline anony-functions (hopefully?) Dan Stromberg <drsalists@gmail.com> - 2014-08-22 16:48 -0700
Re: proposed syntax for multiline anony-functions (hopefully?) Dan Stromberg <drsalists@gmail.com> - 2014-08-22 16:58 -0700
Re: proposed syntax for multiline anony-functions (hopefully?) Marko Rauhamaa <marko@pacujo.net> - 2014-08-23 10:37 +0300
csiph-web