Logging messages with dictionary args in Python 2.4b1 leads to exception
Steve Holden
steve at holdenweb.com
Thu Oct 21 19:34:29 EDT 2004
Vinay Sajip wrote:
>>The only problematic case is a tuple as only argument, everything else
>>should work. So there are three possible solutions for backward compatibility:
>>
>>1) document the change :o)
>>2) check for a dictionary as first argument
>>3) check for a tuple as first argument
>>
>>Since the tuple is the only problematic thing you could hand in, I
>>personally feel a preference for making that the "exception" (i.e. I vote
>>for 3).
>>
>
>
> I would prefer (2), as the change is catering for the specific use
> case of a single dictionary argument. This is what is currently in
> CVS.
>
> Regards,
>
>
> Vinay Sajip
Couldn't we just use keyword arguments to indicate dictionary-style
substitution? That seems to make a simpler, more elegant solution to me:
if args:
msg = msg % args
else:
msg = msg % kwargs
Or am I (as I so often do) missing something?
regards
Steve
--
http://www.holdenweb.com
http://pydish.holdenweb.com
Holden Web LLC +1 800 494 3119
More information about the Python-list
mailing list