On Thu, Sep 20, 2012 at 3:58 PM, <thorso...@lavabit.com> 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 > that contains that value. And what if there is no such dictionary? Or what if there are multiple such dictionaries? > (Yep, this is bizarre.) > > some_magic(list, '4') > => '3' > > What's the functional way to do it? Why do you care about the paradigm used? > Is it possible to do it with a one-liner? Who cares? It's possible to implement more complicated things in one line of APL, but most people probably wouldn't recommend it. Regards, Chris R. -- http://mail.python.org/mailman/listinfo/python-list