Cause for using objects?

Michael Hoffman cam.ac.uk at mh391.invalid
Wed Jun 15 05:21:10 EDT 2005


John Heasly wrote:

> I'm thinking maybe list comprehension is a more appropriate 
> tool.

You have a 1-to-3 relationship between the items of your input list and 
the items of your output dict. I find listcomps are best for 1-to-1 
relationships. Personally I would just use a for loop.

> And I need to keep the return a single dict 'cause that's what the 
> next step in the process expects.

I agree with John Machin, change the next step in the process instead. :)
-- 
Michael Hoffman



More information about the Python-list mailing list