Also, the defaultdict class (in python 2.5 onwards) lets you specify a factory function instead of passing in the default:
http://docs.python.org/library/collections.html#collections.defaultdict This is particularly useful for cases where the default value takes a little while to construct or for shaving a few more lines off your code. (In python 2.6 defaultdict is right beside my new favourite class, namedtuple: http://docs.python.org/library/collections.html#collections.namedtuple) mick On Thu, Mar 12, 2009 at 02:21, Sean O'Donnell <[email protected]> wrote: > > A nice recipe using the idioms discussed tonight > > http://code.activestate.com/recipes/66516/ > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Python Ireland" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.ie/group/pythonireland?hl=en -~----------~----~----~----~------~----~------~--~---
