Terry Reedy <tjreedy <at> udel.edu> writes:

> 
> It appears you are adding two methods to do the same thing. One is to 
> subclass and override one or two functions. The other is to define one 
> or two custom functions and attach as attributes. Both seem equally 
> easy. (Actually, subclassing takes one line less.) Are both really needed?
> 

That's why I asked for comments. Subclassing can be avoided if the callable
attributes are used, which is a win, for example, if you have both timed and
non-timed rotating handlers: you can use the same callables in each case,
whereas with subclassing you would have to subclass both the timed and non-timed
handler classes. Also, in scenarios where one might want to use alternative
compression formats based on an application's configuration, there would be less
work because one wouldn't need to create multiple subclasses.

So for most cases the strategy would be to use the callable attributes, and if
they were inappropriate for some reason, they could subclass and override the
methods. I've factored out the two methods from the existing implementation
because at the moment, it's hard to subclass without copying the whole
doRollover method (as in the ActiveState example).

Regards,

Vinay Sajip



_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to