Learning Pyhton - Functional Programming - How intersect/difference two dict with dict/values? fast!

macm moura.mario at gmail.com
Tue Nov 9 23:41:35 CET 2010


Sorry Mr. Nagle and Folks

I had a bad day today.

I need forward but with fever, a grasp and headache is hard.

You are absolute right, I was rude and I ask your pardon.

About my code, sorry I thought was the best way to copy and paste in
python console.

Best Regards

macm

On Nov 9, 7:03 pm, "D'Arcy J.M. Cain" <da... at druid.net> wrote:
> On Tue, 09 Nov 2010 15:55:16 -0500
>
> Terry Reedy <tjre... at udel.edu> wrote:
> > To echo John Nagle's point, if you want non-masochist volunteers to read
> > your code, write something readable like:
>
> > dict1 = {'ab': [[1,2,3,'d3','d4',5], 12],
> >           'ac': [[1,3,'78a','79b'], 54],
> >           'ad': [[56,57,58,59], 34],
> >           'ax': [[56,57,58,59], 34]}
>
> I have been learning to like this form:
>
> dict1 = dict(
>   ab = [[1,2,3,'d3','d4',5], 12],
>   ac = [[1,3,'78a','79b'], 54],
>   ad = [[56,57,58,59], 34],
>   ax = [[56,57,58,59], 34],
> )
>
> Of course, it only works when all the keys are strings.
>
> --
> D'Arcy J.M. Cain <da... at druid.net>         |  Democracy is three wolveshttp://www.druid.net/darcy/               |  and a sheep voting on
> +1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.




More information about the Python-list mailing list