code style and readability [was: Re: Checking the boolean value of a collection]
Bruno Desthuilliers
bdesth.quelquechose at free.quelquepart.fr
Sat Sep 13 11:12:04 EDT 2008
Bruno Desthuilliers a écrit :
> Larry Bates a écrit :
> (snip)
>> IMHO it reads better if you use the __call__ method of the class to
>> return the value
>
> IMHO, it makes no sense at all to abuse the __call__ magic method here.
Sorry - after a more careful re-read of other posts in the thread, it
might make sense, given the use case :
condition = FolderInUse(core)
if condition.true_for(folder):
# code here
but then, a plain function (or a partial) might be even better - that
is, if the FolderInUse class doesn't have other responsabilities.
More information about the Python-list
mailing list