@@ -498,26 +498,23 @@ is almost as bad: it is expensive and affects other threads that happen to run
498498before the settings have been restored.
499499
500500If, when coding a module for general use, you need a locale independent version
501- of an operation that is affected by the locale (such as :func: ` string.lower `, or
501+ of an operation that is affected by the locale (such as
502502certain formats used with :func: `time.strftime `), you will have to find a way to
503503do it without using the standard library routine. Even better is convincing
504504yourself that using locale settings is okay. Only as a last resort should you
505505document that your module is not compatible with non-\ ``C `` locale settings.
506506
507- .. index :: module: string
508-
509- The case conversion functions in the :mod: `string ` module are affected by the
510- locale settings. When a call to the :func: `setlocale ` function changes the
511- :const: `LC_CTYPE ` settings, the variables ``string.lowercase ``,
512- ``string.uppercase `` and ``string.letters `` are recalculated. Note that code
513- that uses these variable through ':keyword: `from ` ... :keyword: `import ` ...',
514- e.g. ``from string import letters ``, is not affected by subsequent
515- :func: `setlocale ` calls.
516-
517507The only way to perform numeric operations according to the locale is to use the
518508special functions defined by this module: :func: `atof `, :func: `atoi `,
519509:func: `format `, :func: `str `.
520510
511+ There is no way to perform case conversions and character classifications
512+ according to the locale. For (Unicode) text strings these are done according
513+ to the character value only, while for byte strings, the conversions and
514+ classifications are done according to the ASCII value of the byte, and bytes
515+ whose high bit is set (i.e., non-ASCII bytes) are never converted or considered
516+ part of a character class such as letter or whitespace.
517+
521518
522519.. _embedding-locale :
523520
0 commit comments