[Python-Dev] other "magic strings" issues
aleaxit at yahoo.com
Fri Nov 7 16:11:35 EST 2003
On Friday 07 November 2003 19:59, Guido van Rossum wrote:
> Anyway, I've been nearly convinced that the various constants should
> be part of the str class. But should corresponding constants be added
> to the Unicode class??? Some would be very large. If not, I'm less
> convinced that they belong on the str class.
I think the str.XXX constants should be iterables with a __contain__
method (the latter either to forbid the 'if char in str.XXX:" test if we
dislike it, or to optimize it if we like it). The corresponding unicode.XXX
constants could also be iterables -- not necessarily large ones if we
don't want them to be: each of them could just step a counter through
all unicode characters and just return the ones that satisfy some
appropriate .iswhatever test.
> Also, perhaps the locale-dependent variables should perhaps be moved
> into the locale module? That would avoid the Unicode question above,
> because the locale module doesn't apply to Unicode.
+1 -- I think the more "localized" the effects of module locale are, the
happier we shall all be; the "global side effect" of locale.setlocale having
effects on other modules (string, time, os, and gettext) has always left
me a little bit doubtful (I've used it at times, but wished I could avoid
More information about the Python-Dev