On 6/22/10 10:26 AM, Shashwat Anand wrote: > ---- begin ----- > import logging > logging.basicConfig(level=logging.DEBUG,format="%(asctime)s" > "%(levelname)-5.5s [%(name)s %(module)s:%(funcName)s:%(lineno)d]" > "%(message)s") > > def run(): > x = 5 > logging.debug("X = %d" % x) > > run() > ----- end ----- > > You can probably use string default concatenation feature of python. > Anyway, am just nitpicking. Loved your example, as I was unaware of > logging module.
As a sort of personal policy, I never use string concatenation. I do not advocate this position or advise that others should follow it, but in my experience-- for me-- it does not scale. I find I often want to go back and modify or enhance an output with new data, and string concatenation ends up becoming cumbersome after awhile, and so I always use format strings so I don't have to rewrite the line to convert from + to % later. (And in a couple years when I can migrate to Py3, I'll start using .format()) -- Stephen Hansen ... Also: Ixokai ... Mail: me+list/python (AT) ixokai (DOT) io ... Blog: http://meh.ixokai.io/
signature.asc
Description: OpenPGP digital signature
-- http://mail.python.org/mailman/listinfo/python-list