PEP 3119 ABC - And how I learned to love the Abstract Bomb

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Wed May 12 01:29:01 EDT 2010


En Wed, 12 May 2010 01:38:47 -0300, Hatem Nassrat <hnassrat at gmail.com>  
escribió:

> 1. To create a YajlContentHandler class that forces all sub-classers
> to implement a certain set of methods. (Great, thats what ABC is for)
>
> There is a certain set of mutually exclusive callbacks, i.e. if you
> implement the first set you need not implement the second, and vice
> versa, so my second requirement is:
>
> 2. Conditional Abstractness! if certain methods are not implemented
> then be able to require some method to be implemented.

Mmm, can't you use two separate ABCs? Perhaps inheriting from a common  
base.

-- 
Gabriel Genellina




More information about the Python-list mailing list