2009/10/1 Eric Smith <e...@trueblade.com>: > It's tangential, but in the str.format case you don't want to check for just > '{asctime}', because you might want '{asctime:%Y-%m-%d}', for example. > > But there are ways to delay computing the time until you're sure it's > actually being used in the format string, without parsing the format string. > Now that I think of it, the same technique could be used with %-formatting:
Still tangential, but it seems to me that this discussion has exposed a couple of areas where the logging interface is less than ideal: - The introspection of the format string to delay computing certain items (Eric's suggestion may be an improvement here). - The "call str() on any non-string object to get a format string" API (which precludes string subclasses). I suspect other APIs will exist with similar issues once the whole question of supporting multiple format syntaxes gets wider publicity... Paul. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com