meta-class review
Ethan Furman
ethan at stoneleaf.us
Wed Oct 6 00:42:49 EDT 2010
MRAB wrote:
> On 06/10/2010 00:17, Ethan Furman wrote:
> > [snip]
> > Any comments appreciated, especially ideas on how to better handle
> > class- and staticmethods
> >
> I think that's a bit of overkill. The problem lies in the printing
> part, but you're spreading the solution into the rest of the
> application! (A case of the tail wagging the dog, perhaps? :-))
>
> IMHO you should just use a simple function when printing:
>
> def dash_zero(x):
> return str(x) if x else '-'
>
> '%-25s: %7s' % ('DPV Failure', dash_zero(counts['D']))
Yes, simple is better than complex, isn't it? :) And certainly a *lot*
less code!
Thank you for pointing that out -- hopefully my blush of embarassment
will fade by morning.
~Ethan~
More information about the Python-list
mailing list