[Tutor] I can't believe this needs to be this complex
Dick Moores
rdm at rcblue.com
Sat Aug 2 12:07:43 CEST 2008
I'm pretty new to Python's dictionaries, but I had a need for a
function that would find the values in a dict that have more than one
key each. It took me several hours to write. See
<http://py77.python.pastebin.com/f397582d8>. Seems to do the job,
both with the example shown, and with the dict of colors at
<http://py77.python.pastebin.com/f796752ff>.
But I can't believe the function needs to be so complex. And also, I
suppose I've reinvented the wheel (again). Please instruct me.
My apologies in advance to Kent for not using a single list comprehension.
Thanks,
Dick Moores
More information about the Tutor
mailing list