This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author wcmaier
Recipients wcmaier
Date 2008-03-24.13:56:04
SpamBayes Score 0.05246
Marked as misclassified No
Message-id <1206366966.49.0.127979087555.issue2473@psf.upfronthosting.co.za>
In-reply-to
Content
In (at least) Python 2.5.2, logging.logRecord provides a very useful
facility to interpolate formatted strings. This feature expands an *args
sequence; if that sequence has only one element and that element is a
dictionary, LogRecord uses the dictionary to interpolate keyword
formatted strings. This is incredibly useful, but the LogRecord
__init__() method includes a rather arbitrary type-specific check that
prevents users from passing dict-like objects to the log methods:

logging.__init__.py:204..238
class LogRecord:
    [...]
    def __init__(self, name, level, pathname, lineno,
                 msg, args, exc_info, func=None):
        [...]
        if args and (len(args) == 1) and args[0] and (type(args[0]) ==
types.DictType):
            args = args[0]


This restriction prevents the user from passing eg a subclass of
UserDict.DictMixin. Now, __init__() clearly does need to do _some_
checking of args, but it would be nice if that checking accepted
dict-like objects. I haven't come up with a good way to do this myself
yet, but I figured I'd submit the request now.

Thanks!
History
Date User Action Args
2008-03-24 13:56:06wcmaiersetspambayes_score: 0.05246 -> 0.05246
recipients: + wcmaier
2008-03-24 13:56:06wcmaiersetspambayes_score: 0.05246 -> 0.05246
messageid: <1206366966.49.0.127979087555.issue2473@psf.upfronthosting.co.za>
2008-03-24 13:56:05wcmaierlinkissue2473 messages
2008-03-24 13:56:04wcmaiercreate