[issue14868] Allow log calls to return True for code optimization.

R. David Murray report at bugs.python.org
Mon May 21 13:20:00 CEST 2012


R. David Murray <rdmurray at bitdance.com> added the comment:

I would also, however, not be a typical Python coding pattern.  Functions normally return None by default.  The 'assert....or True' pattern makes it reasonably clear what the intent is, which just having logging return True would not, particularly.  As for efficiency, since your are using the assert to improve the efficiency in -O case, the efficiency in the non -O case becomes less important.

I'm -1 on this suggestion (given that there is an easy way to spell what you want to do).  But we can let Vinay decide :)

There is also another way to spell it, by the way:

   if __debug__: 
       logger.debug('log it')

That is even clearer as to intent.  In fact, I'd be inclined to call that TWOWTDI (The One Obvious Way To Do It).

----------
nosy: +r.david.murray, vinay.sajip

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14868>
_______________________________________


More information about the Python-bugs-list mailing list