Derek Peschel wrote:

> At the moment I only need to invert dicts and lists.  Is subclassing dict
> and list considred good style?

if it makes sense for your application, sure.

however, it might be more convenient to just use a simple type check 
(e.g. looking for items) to distinguish between "normal mappings" and 
"normal sequences".

     try:
         items = obj.items()
     except AttributeError:
         items = enumerate(obj) # assume it's a sequence

</F>

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to