On Sat, Nov 9, 2013 at 9:22 AM, Peter Cacioppi <peter.cacio...@gmail.com> wrote:
> my fav so far is this
>
> _ = lambda c : lambda x : c(*x)
>
> c can be any calleable and x any iterable, but I tend to use it with a class, 
> and then map _(class) over the result of a zip.
>
> It must be in the library somewhere, but I haven't found it. I'm never sure 
> what to call it, so I just reroll it into _ as needed. It's pretty easy for 
> me to remember, but I'll probably tattoo it on my chest just in case.

So... for any given class, it returns a tweaked version that unpacks
an iterable of its arguments instead of taking separate args.
Interesting, perhaps, but not something that'll be needed in the
stdlib. But as a demo of how easily Python primitives can be combined
into some fairly elegant code, I think this is as good as any!

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to