[Tutor] filtering within a function.

Michael P. Reilly arcege@shore.net
Tue, 13 Mar 2001 07:34:22 -0500 (EST)


[Charset iso-8859-1 unsupported, filtering to ASCII...]
> On 12 Mar 2001, D-Man replied:
> > Maybe.  Are you using some interesting locales or something?
> >
> > Here:
> >
> > Python 2.0 (#18, Oct 31 2000, 13:55:49) [C] on sunos5
> > Type "copyright", "credits" or "license" for more information.
> > >>> import string
> > >>> len( string.uppercase )
> > 26
> > >>> print string.uppercase
> > ABCDEFGHIJKLMNOPQRSTUVWXYZ
> > >>>

Actually, looking deeper, yes, it is a locale issue.  strop.uppercase,
which replaces string.uppercase, is built using isupper(3) which does
use locale(7) settings on most systems.  This is looking at Python 2.0;
I'm fairly sure that Modules/stropmodule.c didn't change much from
1.5.2.

It looks like the best bet is to build your own value if you want
just the ASCII characters.

  -Arcege

-- 
------------------------------------------------------------------------
| Michael P. Reilly, Release Manager  | Email: arcege@shore.net        |
| Salem, Mass. USA  01970             |                                |
------------------------------------------------------------------------