container-indepentent iteration code ?

Jeff Epler jepler at
Thu Sep 9 15:46:06 CEST 2004

def viter(container):
    """Iterate over values of a container"""
    if hasattr(container, "itervalues"):
        return container.itervalues()
    return iter(container)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <>

More information about the Python-list mailing list