In <mailman.785.1310156331.1164.python-l...@python.org> Andrew Berg <bahamutzero8...@gmail.com> writes:
> Is it bad practice to use this > > logger.error(self.preset_file + ' could not be stored - ' + > > sys.exc_info()[1]) > Instead of this? > > logger.error('{file} could not be stored - > > {error}'.format(file=self.preset_file, error=sys.exc_info()[1])) > Other than the case where a variable isn't a string (format() converts > variables to strings, automatically, right?) and when a variable is used > a bunch of times, concatenation is fine, but somehow, it seems wrong. > Sorry if this seems a bit silly, but I'm a novice when it comes to > design. Plus, there's not really supposed to be "more than one way to do > it" in Python. Concatenation feels ugly/clunky to me. I prefer this usage: logger.error('%s could not be stored - %s' % \ (self.preset_file, sys.exc_info()[1])) -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list