Re: Functional way to compare things inside a list

2012-09-22 Thread Ramchandra Apte
On Saturday, 22 September 2012 12:50:08 UTC+5:30, Andrew Berg wrote: > On 2012.09.22 02:08, Jamie Paul Griffin wrote: > > > I find this intriguing, I had no idea bots existed to post to mailing > > > lists in this way. What's the point of them? > > > > To amuse their owners is my guess. > >

Re: Functional way to compare things inside a list

2012-09-22 Thread Andrew Berg
On 2012.09.22 02:08, Jamie Paul Griffin wrote: > I find this intriguing, I had no idea bots existed to post to mailing > lists in this way. What's the point of them? To amuse their owners is my guess. -- CPython 3.3.0rc2 | Windows NT 6.1.7601.17835 -- http://mail.python.org/mailman/listinfo/pyth

Re: Functional way to compare things inside a list

2012-09-22 Thread Jamie Paul Griffin
[ Ian Kelly wrote on Sat 22.Sep'12 at 0:22:43 -0600 ] > On Fri, Sep 21, 2012 at 7:25 PM, Steven D'Aprano > wrote: > > On Fri, 21 Sep 2012 14:49:55 -0600, Ian Kelly wrote: > > > >> On Fri, Sep 21, 2012 at 1:54 PM, 8 Dihedral > >> wrote: > >>> I don't think functional aspects are only marked

Re: Functional way to compare things inside a list

2012-09-21 Thread 88888 Dihedral
Ian於 2012年9月22日星期六UTC+8下午2時23分43秒寫道: > On Fri, Sep 21, 2012 at 7:25 PM, Steven D'Aprano > > wrote: > > > On Fri, 21 Sep 2012 14:49:55 -0600, Ian Kelly wrote: > > > > > >> On Fri, Sep 21, 2012 at 1:54 PM, 8 Dihedral > > >> wrote: > > >>> I don't think functional aspects are only marked a

Re: Functional way to compare things inside a list

2012-09-21 Thread Ian Kelly
On Fri, Sep 21, 2012 at 7:25 PM, Steven D'Aprano wrote: > On Fri, 21 Sep 2012 14:49:55 -0600, Ian Kelly wrote: > >> On Fri, Sep 21, 2012 at 1:54 PM, 8 Dihedral >> wrote: >>> I don't think functional aspects are only marked as lazy programming. >> >> He wrote "lazy evaluation", not "lazy progr

Re: Functional way to compare things inside a list

2012-09-21 Thread Steven D'Aprano
On Fri, 21 Sep 2012 14:49:55 -0600, Ian Kelly wrote: > On Fri, Sep 21, 2012 at 1:54 PM, 8 Dihedral > wrote: >> I don't think functional aspects are only marked as lazy programming. > > He wrote "lazy evaluation", not "lazy programming". Two entirely > different things. For the record, the

Re: Functional way to compare things inside a list

2012-09-21 Thread 88888 Dihedral
A Ian於 2012年9月22日星期六UTC+8上午4時50分49秒寫道: > On Fri, Sep 21, 2012 at 1:54 PM, 8 Dihedral > > wrote: > > > I don't think functional aspects are only marked as lazy > > > programming. > > > > He wrote "lazy evaluation", not "lazy programming". Two entirely > > different things. > > > > >

Re: Functional way to compare things inside a list

2012-09-21 Thread Joshua Landau
On 21 September 2012 21:49, Ian Kelly wrote: > On Fri, Sep 21, 2012 at 1:54 PM, 8 Dihedral > wrote: > > I don't think functional aspects are only marked as lazy > > programming. > > He wrote "lazy evaluation", not "lazy programming". Two entirely > different things. > > > It just means when

Re: Functional way to compare things inside a list

2012-09-21 Thread Ian Kelly
On Fri, Sep 21, 2012 at 1:54 PM, 8 Dihedral wrote: > I don't think functional aspects are only marked as lazy > programming. He wrote "lazy evaluation", not "lazy programming". Two entirely different things. > It just means when one is experimenting something > the efficient execution in sp

Re: Functional way to compare things inside a list

2012-09-21 Thread 88888 Dihedral
Ulrich Eckhardt於 2012年9月21日星期五UTC+8下午5時15分03秒寫道: > Am 21.09.2012 00:58, schrieb thorso...@lavabit.com: > > > list = [{'1': []}, {'2': []}, {'3': ['4', '5']}] > > > > > > I want to check for a value (e.g. '4'), and get the key of the dictionary > > > that contains that value. > > > > Note: >

Re: Functional way to compare things inside a list

2012-09-21 Thread Ulrich Eckhardt
Am 21.09.2012 00:58, schrieb thorso...@lavabit.com: list = [{'1': []}, {'2': []}, {'3': ['4', '5']}] I want to check for a value (e.g. '4'), and get the key of the dictionary that contains that value. Note: 1. list is a built-in type, who's name is rebound above 2. The list above contains dict

Re: Functional way to compare things inside a list

2012-09-21 Thread Alexander Blinne
On 21.09.2012 00:58, thorso...@lavabit.com wrote: > Hi, > > list = [{'1': []}, {'2': []}, {'3': ['4', '5']}] > > I want to check for a value (e.g. '4'), and get the key of the dictionary > that contains that value. > (Yep, this is bizarre.) > > some_magic(list, '4') > => '3' > > What's the func

Re: Functional way to compare things inside a list

2012-09-21 Thread Chris Rebert
On Thu, Sep 20, 2012 at 3:58 PM, wrote: > Hi, > > list = [{'1': []}, {'2': []}, {'3': ['4', '5']}] Are the dictionaries each guaranteed to only contain a single key-value pair? (Or is your example just simplistic?) > I want to check for a value (e.g. '4'), and get the key of the dictionary > th

Re: Functional way to compare things inside a list

2012-09-21 Thread Ivan@work
On 21.09.2012 00:58, thorso...@lavabit.com wrote: Hi, list = [{'1': []}, {'2': []}, {'3': ['4', '5']}] I want to check for a value (e.g. '4'), and get the key of the dictionary that contains that value. (Yep, this is bizarre.) some_magic(list, '4') => '3' What's the functional way to do it? I

Re: Functional way to compare things inside a list

2012-09-21 Thread Chris Angelico
On Fri, Sep 21, 2012 at 6:28 PM, Chris Rebert wrote: > On Fri, Sep 21, 2012 at 1:23 AM, Chris Angelico wrote: >> On Fri, Sep 21, 2012 at 8:58 AM, wrote: > >> That gets the result, but probably not in the cleanest way. I'm not >> sure off-hand if Python has a convenient way to curry a function,

Re: Functional way to compare things inside a list

2012-09-21 Thread Chris Rebert
On Fri, Sep 21, 2012 at 1:23 AM, Chris Angelico wrote: > On Fri, Sep 21, 2012 at 8:58 AM, wrote: > That gets the result, but probably not in the cleanest way. I'm not > sure off-hand if Python has a convenient way to curry a function, http://docs.python.org/library/functools.html#functools.par

Re: Functional way to compare things inside a list

2012-09-21 Thread Chris Angelico
On Fri, Sep 21, 2012 at 8:58 AM, wrote: > Hi, > > list = [{'1': []}, {'2': []}, {'3': ['4', '5']}] > > I want to check for a value (e.g. '4'), and get the key of the dictionary > that contains that value. > (Yep, this is bizarre.) > > some_magic(list, '4') > => '3' > > What's the functional way t

Functional way to compare things inside a list

2012-09-21 Thread thorsopia
Hi, list = [{'1': []}, {'2': []}, {'3': ['4', '5']}] I want to check for a value (e.g. '4'), and get the key of the dictionary that contains that value. (Yep, this is bizarre.) some_magic(list, '4') => '3' What's the functional way to do it? Is it possible to do it with a one-liner? -- h