classification
Title: bug in string method "title"
Type: behavior Stage:
Components: Interpreter Core Versions: Python 2.5
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: ElGordo, gvanrossum
Priority: normal Keywords:

Created on 2007-12-13 18:06 by ElGordo, last changed 2007-12-13 18:24 by gvanrossum. This issue is now closed.

Messages (2)
msg58544 - (view) Author: Bob Helmbold (ElGordo) Date: 2007-12-13 18:06
Summary: "title" method of string objects does not 
   handle contractions and possessives correctly.
See the following short program and its results for examples.
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
"""
Test of string method 'capitalize'
"""

stringList=["we're",
            "you're",
            "they're",
            "i've",
            "we've",
            "you've",
            "they've",
            "can't",
            "won't",
            "doesn't",
            "haven't",
            "daren't",
            "shouldn't",
            "weren't",
            "wasn't",
            "i'm"
            ]

for item in stringList:
    n=len(item)
    spaces=' '*(12-n)
    itemTitled = item.title()
    isATitle = itemTitled.istitle()
    print "%s -> %s%s is title=%s" %(item, spaces, itemTitled, isATitle)

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Results in:
we're ->        We'Re is title=True
you're ->       You'Re is title=True
they're ->      They'Re is title=True
i've ->         I'Ve is title=True
we've ->        We'Ve is title=True
you've ->       You'Ve is title=True
they've ->      They'Ve is title=True
can't ->        Can'T is title=True
won't ->        Won'T is title=True
doesn't ->      Doesn'T is title=True
haven't ->      Haven'T is title=True
daren't ->      Daren'T is title=True
shouldn't ->    Shouldn'T is title=True
weren't ->      Weren'T is title=True
wasn't ->       Wasn'T is title=True
i'm ->          I'M is title=True
msg58552 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2007-12-13 18:24
That's not going to change.
History
Date User Action Args
2007-12-13 18:24:36gvanrossumsetstatus: open -> closed
resolution: wont fix
messages: + msg58552
nosy: + gvanrossum
2007-12-13 18:06:36ElGordocreate