Re: code style and readability [was: Re: Checking the boolean value of a collection]

2008-09-13 Thread Fredrik Lundh
Larry Bates wrote: I also have a personal dislike for early returns because I've found it makes it harder insert execution trace logging into the code. in a language that makes it trivial to wrap arbitrary callables in tracing wrappers? -- http://mail.python.org/mailman/listinfo/python-li

Re: code style and readability [was: Re: Checking the boolean value of a collection]

2008-09-13 Thread Bruno Desthuilliers
Bruno Desthuilliers a écrit : Larry Bates a écrit : (snip) Sorry but I respectfully disagree that this is "abuse" of the __call__ method. As long as we respectfully agree to disagree... !-) Anyway, I don't think we have enough background to seriously agree or disagree on what would make

Re: code style and readability [was: Re: Checking the boolean value of a collection]

2008-09-13 Thread Bruno Desthuilliers
Larry Bates a écrit : Bruno Desthuilliers wrote: 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 car

Re: code style and readability [was: Re: Checking the boolean value of a collection]

2008-09-13 Thread Larry Bates
Bruno Desthuilliers wrote: 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 p

Re: code style and readability [was: Re: Checking the boolean value of a collection]

2008-09-13 Thread Bruno Desthuilliers
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 migh

Re: code style and readability [was: Re: Checking the boolean value of a collection]

2008-09-13 Thread Bruno Desthuilliers
Marco Bizzarri a écrit : On Sat, Sep 13, 2008 at 4:11 PM, Fredrik Lundh <[EMAIL PROTECTED]> wrote: Marco Bizzarri wrote: class FolderInUse: def true_for(self, archivefolder): return any([instance.forbid_to_close(archivefolder) for instance in self.core.active_outgoing_reg

Re: code style and readability [was: Re: Checking the boolean value of a collection]

2008-09-13 Thread Bruno Desthuilliers
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. and rewrite it as a regular loop for clarity. Sometimes the simplest way is the easiest to read. class

Re: code style and readability [was: Re: Checking the boolean value of a collection]

2008-09-13 Thread Larry Bates
Marco Bizzarri wrote: On Sat, Sep 13, 2008 at 4:11 PM, Fredrik Lundh <[EMAIL PROTECTED]> wrote: Marco Bizzarri wrote: class FolderInUse: def true_for(self, archivefolder): return any([instance.forbid_to_close(archivefolder) for instance in self.core.active_outgoing_regist

code style and readability [was: Re: Checking the boolean value of a collection]

2008-09-13 Thread Marco Bizzarri
On Sat, Sep 13, 2008 at 4:11 PM, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Marco Bizzarri wrote: > >> class FolderInUse: > >> >> >>def true_for(self, archivefolder): >>return any([instance.forbid_to_close(archivefolder) for instance in >>self.core.active_outgoing_registrati