Good question. Personally I hate this warning, I like new-style formatting
far more than "%"-style formatting (and in fact, what pylint wants is
neither -- it prefers something like `logging.info('my msg is %',
my_msg)`). The stated reason (
https://bitbucket.org/logilab/pylint/pull-requests/169/add-new-warning-logging-format/diff)
is that this defers the string interpolation until it is actually required
(if/when the logger is called) and therefore provides a performance
enhancement -- I find it incredibly hard to believe that this yields any
measurable improvement. In addition, I haven't found any PEP or other
official documentation that says this behavior is preferred (as opposed to
merely possible). I would support disabling the warning entirely.J On Mon, Oct 17, 2016 at 10:04 AM Maycock, Luke < [email protected]> wrote: > Hi Dev List, > > We're currently working on removing all of the new Landscape.io warnings > from some of our code and we're noticing the following quite a lot: > > "Use % formatting in logging functions and pass the % parameters as > arguments" > > This is being flagged up on lines such as: > > "logging.info("Running command:\n {}".format(hql))" > > We're just wondering whether it is indeed preferred to use the % > parameters as suggested or whether this is an issue with the Landscape.io > setup. > > Can anybody give a judgement on this? If the .format is preferred, then > we'll look into changing the landscape.io settings. > > Thanks, > > Luke Maycock > OLIVER WYMAN > [email protected]<mailto: > [email protected]> > www.oliverwyman.com<http://www.oliverwyman.com/> > > > ________________________________ > This e-mail and any attachments may be confidential or legally privileged. > If you received this message in error or are not the intended recipient, > you should destroy the e-mail message and any attachments or copies, and > you are prohibited from retaining, distributing, disclosing or using any > information contained herein. Please inform us of the erroneous delivery by > return e-mail. Thank you for your cooperation. >
