Message123270
| Author |
belopolsky |
| Recipients |
belopolsky, docs@python, ezio.melotti, lemburg, loewis, vstinner |
| Date |
2010年12月03日.17:08:21 |
| SpamBayes Score |
0.0021475467 |
| Marked as misclassified |
No |
| Message-id |
<1291396103.28.0.745658463289.issue10587@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
As discussed in issue10610, it is important to keep the gory details in one place and refer to it throughout the manual. I think the Unicode terminology is best exposed in the unicodedata module documentation. For string character-type methods, I suggest presenting an equivalent to unicodedata expression where possible. For example, x.isalpha() is equivalent to all(unicodedata.category(c) in 'Lu Ll Lt Lm Lo' for c in x) or many be just a "character c is alphabetical if unicodedata.category(c) in 'Lu Ll Lt Lm Lo' is true.
Other examples:
isdigit() -> unicodedata.digit(c, None) is not None
isdecimal() -> unicodedata.decimal(c, None) is not None
isnumeric() -> unicodedata.numeric(c, None) is not None
isprintable()-> unicodedata.category(c) not in 'Cc Cf Cs Co Cn Zl Zp Zs'
islower() -> unicodedata.category(c) == 'Ll'
isupper() -> unicodedata.category(c) == 'Lu'
istitle() -> unicodedata.category(c) == 'Lt'
isalnum() -> isalpha() or isdecimal() or isdigit() or isnumeric()
I am not sure about equivalent to expressions for isidentifier() and isspace(). |
|