Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #58997
| References | <fbbabb45-f0e3-4e7f-968f-9822607c450a@googlegroups.com> <dae981ac-14e7-47c8-89ed-a5ad21e956ca@googlegroups.com> |
|---|---|
| Date | 2013-11-10 21:23 +1100 |
| Subject | Re: my favorite line of py code so far |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2328.1384079035.18130.python-list@python.org> (permalink) |
On Sun, Nov 10, 2013 at 7:57 PM, Peter Cacioppi <peter.cacioppi@gmail.com> wrote: > Chris said : > > "I think map is fine if you can use a named function, but if you can't > come up with a descriptive name for what you're doing, a comprehension > is probably better (as it'll have the code right there). Mapping _ > across everything tells you nothing about what it's actually doing" > > How about this? I put the following in my catchall_utility.py module > > # the oneArg combinator takes a multi-argument calleable > # and returns the equivalent single argument calleable > oneArg = lambda c: lambda x : c(*x) Now it has a name, so I could imagine you importing it into modules and using it usefully. I'd be inclined to call it something along the lines of "unpacked" but that's just bikeshedding. > ... I find that I write fewer bugs when I use idioms that resonate. Absolutely! The unfortunate truth, though, is that idioms that resonate with you _and nobody else_ are just as big a problem as bugs, because they're unmaintainable. So hopefully what you're doing will make sense to other people too! ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
my favorite line of py code so far Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-11-08 14:22 -0800
Re: my favorite line of py code so far Chris Angelico <rosuav@gmail.com> - 2013-11-09 09:32 +1100
Re: my favorite line of py code so far Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-11-08 14:43 -0800
Re: my favorite line of py code so far Peter Otten <__peter__@web.de> - 2013-11-09 08:12 +0100
Re: my favorite line of py code so far Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-11-09 01:23 -0800
Re: my favorite line of py code so far Chris Angelico <rosuav@gmail.com> - 2013-11-09 20:28 +1100
Re: my favorite line of py code so far Paul Rubin <no.email@nospam.invalid> - 2013-11-09 01:49 -0800
Re: my favorite line of py code so far Peter Otten <__peter__@web.de> - 2013-11-09 12:49 +0100
Re: my favorite line of py code so far Stefan Behnel <stefan_ml@behnel.de> - 2013-11-09 13:41 +0100
Re: my favorite line of py code so far Chris Angelico <rosuav@gmail.com> - 2013-11-09 23:45 +1100
Re: my favorite line of py code so far Peter Otten <__peter__@web.de> - 2013-11-09 14:49 +0100
Re: my favorite line of py code so far Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-11-10 00:57 -0800
Re: my favorite line of py code so far Chris Angelico <rosuav@gmail.com> - 2013-11-10 21:23 +1100
Re: my favorite line of py code so far Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-11-10 00:59 -0800
Re: my favorite line of py code so far Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-11-10 16:00 -0800
csiph-web