Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #85559
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Subject | Re: Alternative to multi-line lambdas: Assign-anywhere def statements |
| Date | 2015-02-11 21:06 -0500 |
| References | <CAPTjJmrAQgtauH74dwCzb_-6T09D0dLVkxiGrAxJMp_OOwgS0g@mail.gmail.com> <54C3EAD1.2010501@stoneleaf.us> <CAPTjJmohdQbK9_ikh8heaMRbpJ270UW6C1AE2oNVgV_4AoYfQg@mail.gmail.com> <mailman.18121.1422151185.18130.python-list@python.org> <54db5356$0$3915$e4fe514c@dreader34.news.xs4all.nl> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.18674.1423706801.18130.python-list@python.org> (permalink) |
On 2/11/2015 8:04 AM, Albert van der Horst wrote: > It is not until we assign the object to a name (which becomes thereby a function) > that the __name__ thingy comes into play, like so. But __name__ would not come into play. > f = x->x**2 This would mean to create an anonymous function object and then bind 'f' to that object in the current local namespace. It would be the same as the discouraged f = lambda x: x**2 > I've heard arguments that with -> the __name__ is not filled in correctly. Because local namespace name binding does not and should not mutate the object the name is bound to. > I can't see why the parser would understand more easily > > def f(x): > return x**2 > than > > f = x-> > return x**2 The parser parses both equally well. That is not the issue. -- Terry Jan Reedy
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: Alternative to multi-line lambdas: Assign-anywhere def statements Ethan Furman <ethan@stoneleaf.us> - 2015-01-24 17:58 -0800
Re: Alternative to multi-line lambdas: Assign-anywhere def statements Yawar Amin <yawar.amin@gmail.com> - 2015-01-24 18:30 -0800
Re: Alternative to multi-line lambdas: Assign-anywhere def statements Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-25 15:27 +1100
Re: Alternative to multi-line lambdas: Assign-anywhere def statements Yawar Amin <yawar.amin@gmail.com> - 2015-01-25 17:26 -0800
Re: Alternative to multi-line lambdas: Assign-anywhere def statements Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-26 13:46 +1100
Re: Alternative to multi-line lambdas: Assign-anywhere def statements albert@spenarnc.xs4all.nl (Albert van der Horst) - 2015-02-11 13:04 +0000
Re: Alternative to multi-line lambdas: Assign-anywhere def statements Clarence <clarence1126@gmail.com> - 2015-02-11 06:28 -0800
Re: Alternative to multi-line lambdas: Assign-anywhere def statements Ethan Furman <ethan@stoneleaf.us> - 2015-02-11 08:52 -0800
Re: Alternative to multi-line lambdas: Assign-anywhere def statements Terry Reedy <tjreedy@udel.edu> - 2015-02-11 21:06 -0500
Re: Alternative to multi-line lambdas: Assign-anywhere def statements Ian Kelly <ian.g.kelly@gmail.com> - 2015-02-11 19:57 -0700
Re: Alternative to multi-line lambdas: Assign-anywhere def statements Chris Angelico <rosuav@gmail.com> - 2015-02-12 14:56 +1100
Re: Alternative to multi-line lambdas: Assign-anywhere def statements Ian Kelly <ian.g.kelly@gmail.com> - 2015-02-12 09:17 -0700
csiph-web