Iterating over a dictionary's sorted keys

Peter Schneider-Kamp petersc at
Mon May 29 04:46:44 EDT 2000

Mark Hammond wrote:
> I agree its handy, but dont think it's worth adding a convenience function
> to collapse two lines down to one.  There are _lots_ of really, really
> handy things you can do in 2 lines of Python, so where would we stop?

When we reach the complexity of the Java interface...

But he can always take a copy of with his program an put
his convenience stuff in there. As long as he distributes
it's imho no problem.

Java-'s-not-that-bad-but-don't-let-your-children-near-it-ly y'rs

*** Mon May 29 10:41:25 2000
---   Mon May 29 10:39:19 2000
*** 21,26 ****
--- 21,30 ----
          import copy
          return copy.copy(self)
      def keys(self): return
+     def sorted_keys(self):
+         keys =
+         keys.sort()
+         return keys
      def items(self): return
      def values(self): return
      def has_key(self, key): return

More information about the Python-list mailing list