Message93277
Antoine Pitrou wrote:
> capwords() itself could be deprecated, since it's an obvious one-
> Replacing in with another method, however, will just confuse and
annoy
> existing users.
Yes, sorry, I meant the semantics, where as you are right for the
specific function.
Marc-Andre Lemburg wrote:
> Note however, that word boundaries are just as complicated as casing:
> there are lots of special cases in different languages or locales
> (see the notes after the word boundary rules in the TR29).
ICU already has the full implementation, so Python could get away with
just supporting the default implementation (as seen with other case
mappings).
>>> from PyICU import UnicodeString, Locale, BreakIterator
>>> en_US_locale = Locale('en_US')
>>> breakIter = BreakIterator.createWordInstance(en_US_locale)
>>> s = UnicodeString("There's a hole in the bucket.")
>>> print s.toTitle(breakIter, en_US_locale)
There's A Hole In The Bucket.
>>> breakIter.setText("There's a hole in the bucket.")
>>> last = 0
>>> for i in breakIter:
... print s[last:i]
... last = i
...
There's
A
Hole
In
The
Bucket
. |
|
Date |
User |
Action |
Args |
2009-09-29 11:01:33 | christoph | set | recipients:
+ christoph, lemburg, gvanrossum, nnorwitz, rhettinger, pitrou, ezio.melotti, r.david.murray, markon, twb, nickd |
2009-09-29 11:01:33 | christoph | set | messageid: <1254222093.11.0.58452995351.issue7008@psf.upfronthosting.co.za> |
2009-09-29 11:01:31 | christoph | link | issue7008 messages |
2009-09-29 11:01:31 | christoph | create | |
|