On Sat, Jul 20, 2019 at 11:10:53AM +1000, Cameron Simpson wrote: > On 19Jul2019 01:18, Nicolas Sebrecht <[email protected]> wrote: > > On Thu, Jul 18, 2019 at 01:34:46PM +0300, gwn wrote: > > > So that the hook can implement advanced features that acts on the > > > newly synced mail content. > [...] > > > if self.newmail_hook != None: > > > > BTW, this check should be merged with the 'have_newmail' check. > > Is there a reason this is not "is not" instead of "!=" ? > > If you're being Pythonic, a plain "if self.newmail_hook:" would suffice, but > an equality check with None is very meaningful. It is a singleton, so you > should be using "is" or falling back to the unadorned truthy/falsey bare "if > self.newmail_hook:".
"is not None" is the most restrictive check to what is expected. That's what we tend to use. It's the most meaningful about what we are checking. I don't follow all the pythonist policies but I don't block/reject patches from contributors because of this. -- Nicolas Sebrecht _______________________________________________ OfflineIMAP-project mailing list: [email protected] https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/offlineimap-project OfflineIMAP homepages: - https://github.com/OfflineIMAP - http://offlineimap.org
