[Python-Dev] String module

Fredrik Lundh fredrik@pythonware.com
Fri, 31 May 2002 13:50:51 +0200


mal wrote:   =20

> Do you really think this proliferation of issomething()
> methods is a good idea ?
>=20
> The same can be had using re.metch() with *much* more flexibility
> since you're not stuck with an "intuitive" definition relying
> on the intuition of some non-standard body.
>=20
> FWIW, I've never used a single one of these single
> character based classification APIs. The only non-trivial
> issomething() method I can think of is .istitle() because
> of it's complicated definition. All others can easily
> be had with re.match().

I fully agree.

the SRE engine already supports character classes based on
ASCII, the current locale (via ctype.h), and the Unicode char-
set.

we should probably add more classes -- at least the full list of
POSIX [:name:] classes, and probably also unicode categories.

fwiw, I've played with adding "charset" objects to SRE, which
would allow you to plug in custom [:spam:] sets as well (e.g.
xml name chars).

</F>