dict slice in python (translating perl to python)

Fredrik Lundh fredrik at pythonware.com
Wed Sep 10 12:46:56 EDT 2008


B wrote:
> for a long list, you could try:
> result = [mydict[k] for k in mydict]
> or       [mydict[k] for k in mydict.keys()]
> or       [mydict[k] for k in mydict.iterkeys()]

and the point of doing that instead of calling mydict.values() is what?

</F>




More information about the Python-list mailing list