On Sep 11, 2011, at 11:49 AM, Michael Foord wrote:
> Does anyone *actually* use .title() for this? (And why not just use the
> correct casing in the string literal...)
Yes. Twisted does, in various MIME-ish places (IMAP, SIP), although not in
HTTP from what I can see. I imagine other similar software would as well.
One issue is that you don't always have a string literal to work with. If
you're proxying traffic, you start from a mis-cased header and you possibly
need to correct it to a canonically-cased one. (On at least one occasion I've
had to use such a proxy to make certain buggy client software work.)
Of course you could have something like {b"CONNECTION-LOST":
b"Connection-Lost", ...} somewhere at module scope, but that feels a bit
sillier than just having a nice '.title()' method.
-glyph
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com