Wish: Allow all log Handlers to accept the level argument
Peter Otten
__peter__ at web.de
Thu May 24 06:23:15 EDT 2012
Jean-Michel Pichavant wrote:
> Fayaz Yusuf Khan wrote:
>> Jean-Michel Pichavant wrote:
>>
>>> Meanwhile you can shorten the code this way:
>>>
>>> root.addHandler(FileHandler('debug.log'))
>>> root.handlers[-1].setLevel(DEBUG)
>>>
>>>
>> Eh? Readability was the aim.
>>
> I fail to see how it's not readable, code is short and no magic is
> involved provided you know about slicing list items. Anyway, to answer
You have to know or verify that .addHandler() appends to the .handlers list,
you have to check if or under which conditions
h = SomeHandler()
root.addHandler(h)
assert h is root.handlers[-1]
can fail. In short, if I see such a hack my trust in the author of that code
is significantly lowered.
More information about the Python-list
mailing list