M
Marco Bizzarri
Marco said:class FolderInUse:def true_for(self, archivefolder):
return any([instance.forbid_to_close(archivefolder) for instance in
self.core.active_outgoing_registration_instances()])
Is this any better? The true_for name does not satisfy me a lot...
well, "true_for" is indeed pretty inscrutable, but I'm not sure that would
be the first thing I'd complain about in that verbose mess...
"verbose mess".
It is always frustrating when you do what you think is your best and
you read that.
Anyway: I'm here to learn, and, of course, part of it is to listen
those who've been there much longer than you.
So, thanks for your sincere evaluation, Fredrik .
(when you pick method names, keep in mind that the reader will see the
context, the instance, and the arguments at the same time as they see the
name. there's no need to use complete sentences; pick short short
descriptive names instead.)
Maybe I'm looking at the wrong direction, right now. From the point of
view of the FolderInUse clients, they will do:
condition = FolderInUse(core)
condition.true_for(folder)
Is this too verbose? This is not a polemic statement, I'm really
asking your opionion.
The expression inside the true_for is indeed complex, and maybe I can
simplify it; however, I'm deeply convinced that
instance.forbid_to_close(folder)
has some good points on it; I mean, once I read this kind of code, I
can hope to understand it without looking at what forbid_to_close
does.