[PATCH 3/8] Re: add sync_this variable to all Folder() instances

Sebastian Spaeth Sebastian at SSpaeth.de
Mon Sep 5 09:43:27 BST 2011


On Sat, 3 Sep 2011 14:52:34 +0200, Nicolas Sebrecht <nicolas.s-dev at laposte.net> wrote:
> > -        return retval
> > +        return self.folders
> 
> I'm a bit sceptic, here. My questions are :
> - can we build self.folders directly all along the method?
> - do we need the temporary 'retval' variable in the first place
>   (concurrent access or whatever)?
> - if 'retval' is needed, _when_ should it be saved as attribute? Is the
>   last statement of the method the real good place to do so?

Right, I was thinking the same and initially thought we could just use
self.folders all the time, however, if we fail throughout, we end up with a
half-populated self.folders list. This way (which is the way it has been
before), we will either have self.folders=None if we fail, or we have
the full list once we succeeded (that's why it is one of the last
statements to actually assigned retval to self.folders.

We could do it differently and use self.folders all the way, catching
any exceptions which set self.folders to None, but that would mean one
more level of indent. *shrug*, I don't have strong opinions on what
would be the better way.

Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/offlineimap-project/attachments/20110905/716b5e4a/attachment-0001.sig>


More information about the OfflineIMAP-project mailing list