[Urwid] palette container

Ian Ward ian at excess.org
Wed Aug 17 09:27:31 EDT 2011


Yu-Jie Lin wrote on 2011-08-17 00:59:
> class CPDict(dict):
>     """Cascading (Escape) Palette for Pygments token
> 
>     Only works if ancestor is already defined.
>     """
>     def __contains__(self, k):
...

I've heard that it's a bad idea to subclass dict (or any of the standard
python containers) unless you override pretty much every special method.
 Their implementations assume that the methods haven't been changed in a
subclass, and you might get surprising behaviour.

Ian




More information about the Urwid mailing list