On Wed, Sep 9, 2009 at 7:48 AM, kevin parks <k...@mac.com> wrote: > Then i can cast it as a dict and pick over that dictionary as i wish.
There is no need for that. defaultdict is a subclass of dict and supports all the methods of dict. > Here > (as a bonus) I can transverse a range of keys that is inclusive of all my > keys and also use python's get() dict method to also indicate index points > (keys) that are empty.. which by default returns 'None', which is also > useful in this case to show me what is missing. But I also have to do some > type testing tomfoolery since missing keys return None, which is a special > type (and not a list like the others)... I wanted the value list sorted > so... i did if type(item) == type(foo): .... not sure if there is a > betterererer way. Besides Lie's suggestions, you could use item = gamut.get(x, []) item.sort() print x, item Kent _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor