Use setdefault in handleHeader

[email protected] Thu, 14 Jan 2010 10:46:41 -0000
Newsgroups gmane.comp.python.twisted.bugs
Message-ID <[email protected]>
New submission from johnnyg <None>:

In twisted/web/client.py, the function handleHeader (on L66) does:

{{{
#!python
l = self.headers[key] = self.headers.get(key, [])
}}}

which is less clear and less efficient than doing:

{{{
#!python
l = self.headers.setdefault(key, [])
}}}

I've also attached a patch if you're feeling lazy.

----------
Type     : defect
Component: web
Keywords : 
Priority : normal
Nosy     : 
----------
http://twistedmatrix.com/trac/ticket/4216