>> I doubt there are many uses at all for dict.keys() -- most uses can jsut use the dict.
>
> I use key() all the time to sort the keys before printing.
>
> for name in sorted(dict.key()):
> print(name, dict[name)
Why not just use sorted(dict)?
Thanks for so nicely making my point :-)
Though I do like the keys() version: it seems more obvious to me.
-CHB
--
Christopher Barker, PhD
Python Language Consulting
- Teaching
- Scientific Software Development
- Desktop GUI and Web Development
- wxPython, numpy, scipy, Cython