Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 960fdf9

Browse files
committed
Added the constants ascii_letters, ascii_lowercase, and ascii_uppercase
to the string module. This was determined to be the right approach in SF bug #226706.
1 parent a6d2a04 commit 960fdf9

3 files changed

Lines changed: 33 additions & 3 deletions

File tree

Doc/lib/libstring.tex

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,22 @@ \section{\module{string} ---
1212

1313
The constants defined in this module are:
1414

15+
\begin{datadesc}{ascii_letters}
16+
The concatenation of the \constant{ascii_lowercase} and
17+
\constant{ascii_uppercase} constants described below. This value is
18+
not locale-dependent.
19+
\end{datadesc}
20+
21+
\begin{datadesc}{ascii_lowercase}
22+
The lowercase letters \code{'abcdefghijklmnopqrstuvwxyz'}. This
23+
value is not locale-dependent and will not change.
24+
\end{datadesc}
25+
26+
\begin{datadesc}{ascii_uppercase}
27+
The uppercase letters \code{'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}. This
28+
value is not locale-dependent and will not change.
29+
\end{datadesc}
30+
1531
\begin{datadesc}{digits}
1632
The string \code{'0123456789'}.
1733
\end{datadesc}
@@ -22,15 +38,19 @@ \section{\module{string} ---
2238

2339
\begin{datadesc}{letters}
2440
The concatenation of the strings \constant{lowercase} and
25-
\constant{uppercase} described below.
41+
\constant{uppercase} described below. The specific value is
42+
locale-dependent, and will be updated when
43+
\function{locale.setlocale()} is called.
2644
\end{datadesc}
2745

2846
\begin{datadesc}{lowercase}
2947
A string containing all the characters that are considered lowercase
3048
letters. On most systems this is the string
3149
\code{'abcdefghijklmnopqrstuvwxyz'}. Do not change its definition ---
3250
the effect on the routines \function{upper()} and
33-
\function{swapcase()} is undefined.
51+
\function{swapcase()} is undefined. The specific value is
52+
locale-dependent, and will be updated when
53+
\function{locale.setlocale()} is called.
3454
\end{datadesc}
3555

3656
\begin{datadesc}{octdigits}
@@ -53,7 +73,9 @@ \section{\module{string} ---
5373
letters. On most systems this is the string
5474
\code{'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}. Do not change its definition ---
5575
the effect on the routines \function{lower()} and
56-
\function{swapcase()} is undefined.
76+
\function{swapcase()} is undefined. The specific value is
77+
locale-dependent, and will be updated when
78+
\function{locale.setlocale()} is called.
5779
\end{datadesc}
5880

5981
\begin{datadesc}{whitespace}

Lib/string.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
lowercase = 'abcdefghijklmnopqrstuvwxyz'
2525
uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
2626
letters = lowercase + uppercase
27+
ascii_lowercase = lowercase
28+
ascii_uppercase = uppercase
29+
ascii_letters = ascii_lowercase + ascii_uppercase
2730
digits = '0123456789'
2831
hexdigits = digits + 'abcdef' + 'ABCDEF'
2932
octdigits = '01234567'

Misc/NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ Core
149149

150150
Library
151151

152+
- The constants ascii_letters, ascii_lowercase. and ascii_uppercase
153+
were added to the string module. These a locale-indenpendent
154+
constants, unlike letters, lowercase, and uppercase. These are now
155+
use in appropriate locations in the standard library.
156+
152157
- The flags used in dlopen calls can now be configured using
153158
sys.setdlopenflags and queried using sys.getdlopenflags.
154159

0 commit comments

Comments
 (0)