container-indepentent iteration code ?

Jeremy Bowers jerf at jerf.org
Wed Sep 8 19:45:53 EDT 2004


On Wed, 08 Sep 2004 19:27:38 -0400, flacco wrote:

> 
> is there a way to iterate over the *values* in a list/dict/whatever, 
> regardless of whether it's a list, dict, or whatever?  ie, the iteration 
> code will not know beforehand what kind of container it's getting.

In what way does

for obj in container:

not meet your needs?




More information about the Python-list mailing list