[Python-Dev] Maintenance burden of str.swapcase
Nick Coghlan
ncoghlan at gmail.com
Wed Sep 7 05:00:16 CEST 2011
On Wed, Sep 7, 2011 at 11:53 AM, Stephen J. Turnbull <stephen at xemacs.org> wrote:
> Nick Coghlan writes:
> > The case-related methods, though, have no place in sane wire
> > protocol handling.
>
> RFC 822 headers are a somewhat insane but venerable (isn't that true
> of anything that's reached age 350 in dog-years?), and venerated,
> counterexample. Specifically, field names are case-insensitive (RFC
> 5322, section 1.2.2). I'll bet you can find plenty of others if you
> look. You can call that "text" and say it should be processed in
> Unicode, if you like, but you're not even going to convince me (and as
> I say, I like the Kool-Aid). Specifically, SMTP processes can (and
> even MUST, under some circumstances IIRC) manipulate the RFC 822 header.
>
> Sorry, Nick, no can do.
>
> -1
Heh, I knew as soon as I sent that message that someone would be able
to point out a counter example. I agree that RFC 822 (and
case-insensitive ASCII comparison in general) is enough to save
lower() and upper() and co, but what about this even further reduced
list of text-specific methods:
'capitalize'
'istitle'
'swapcase'
'title'
While case-insensitive comparison makes sense for wire level data,
where do these methods fit in, even when embedded ASCII text fragments
are involved?
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-Dev
mailing list