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

Skip to content

Commit 967f1e3

Browse files
committed
Remove string.{letters,lowercase,uppercase}.
1 parent 5424df2 commit 967f1e3

8 files changed

Lines changed: 17 additions & 46 deletions

File tree

Doc/lib/libstring.tex

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@ \subsection{String constants}
1313

1414
The constants defined in this module are:
1515

16-
\begin{datadesc}{ascii_letters}
16+
\begin{datadesc}{ascii\_letters}
1717
The concatenation of the \constant{ascii_lowercase} and
1818
\constant{ascii_uppercase} constants described below. This value is
1919
not locale-dependent.
2020
\end{datadesc}
2121

22-
\begin{datadesc}{ascii_lowercase}
22+
\begin{datadesc}{ascii\_lowercase}
2323
The lowercase letters \code{'abcdefghijklmnopqrstuvwxyz'}. This
2424
value is not locale-dependent and will not change.
2525
\end{datadesc}
2626

27-
\begin{datadesc}{ascii_uppercase}
27+
\begin{datadesc}{ascii\_uppercase}
2828
The uppercase letters \code{'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}. This
2929
value is not locale-dependent and will not change.
3030
\end{datadesc}
@@ -37,23 +37,6 @@ \subsection{String constants}
3737
The string \code{'0123456789abcdefABCDEF'}.
3838
\end{datadesc}
3939

40-
\begin{datadesc}{letters}
41-
The concatenation of the strings \constant{lowercase} and
42-
\constant{uppercase} described below. The specific value is
43-
locale-dependent, and will be updated when
44-
\function{locale.setlocale()} is called.
45-
\end{datadesc}
46-
47-
\begin{datadesc}{lowercase}
48-
A string containing all the characters that are considered lowercase
49-
letters. On most systems this is the string
50-
\code{'abcdefghijklmnopqrstuvwxyz'}. Do not change its definition ---
51-
the effect on the routines \function{upper()} and
52-
\function{swapcase()} is undefined. The specific value is
53-
locale-dependent, and will be updated when
54-
\function{locale.setlocale()} is called.
55-
\end{datadesc}
56-
5740
\begin{datadesc}{octdigits}
5841
The string \code{'01234567'}.
5942
\end{datadesc}
@@ -69,16 +52,6 @@ \subsection{String constants}
6952
\constant{punctuation}, and \constant{whitespace}.
7053
\end{datadesc}
7154

72-
\begin{datadesc}{uppercase}
73-
A string containing all the characters that are considered uppercase
74-
letters. On most systems this is the string
75-
\code{'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}. Do not change its definition ---
76-
the effect on the routines \function{lower()} and
77-
\function{swapcase()} is undefined. The specific value is
78-
locale-dependent, and will be updated when
79-
\function{locale.setlocale()} is called.
80-
\end{datadesc}
81-
8255
\begin{datadesc}{whitespace}
8356
A string containing all characters that are considered whitespace.
8457
On most systems this includes the characters space, tab, linefeed,

Lib/string.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,14 @@
1616

1717
# Some strings for ctype-style character classification
1818
whitespace = ' \t\n\r\v\f'
19-
lowercase = 'abcdefghijklmnopqrstuvwxyz'
20-
uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
21-
letters = lowercase + uppercase
22-
ascii_lowercase = lowercase
23-
ascii_uppercase = uppercase
19+
ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
20+
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
2421
ascii_letters = ascii_lowercase + ascii_uppercase
2522
digits = '0123456789'
2623
hexdigits = digits + 'abcdef' + 'ABCDEF'
2724
octdigits = '01234567'
2825
punctuation = """!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~"""
29-
printable = digits + letters + punctuation + whitespace
26+
printable = digits + ascii_letters + punctuation + whitespace
3027

3128
# Case conversion helpers
3229
# Use str to convert Unicode literal in case of -U

Lib/test/test_csv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ def test_float_write(self):
645645

646646
def test_char_write(self):
647647
import array, string
648-
a = array.array('u', string.letters)
648+
a = array.array('u', string.ascii_letters)
649649

650650
with TemporaryFile("w+b") as fileobj:
651651
writer = csv.writer(fileobj, dialect="excel")

Lib/test/test_pkgimport.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class TestImport(unittest.TestCase):
77
def __init__(self, *args, **kw):
88
self.package_name = 'PACKAGE_'
99
while self.package_name in sys.modules:
10-
self.package_name += random.choose(string.letters)
10+
self.package_name += random.choose(string.ascii_letters)
1111
self.module_name = self.package_name + '.foo'
1212
unittest.TestCase.__init__(self, *args, **kw)
1313

@@ -58,7 +58,7 @@ def test_package_import__semantics(self):
5858
# ...make up a variable name that isn't bound in __builtins__
5959
var = 'a'
6060
while var in dir(__builtins__):
61-
var += random.choose(string.letters)
61+
var += random.choose(string.ascii_letters)
6262

6363
# ...make a module that just contains that
6464
self.rewrite_file(var)

Lib/test/test_string.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ class ModuleTest(unittest.TestCase):
66

77
def test_attrs(self):
88
string.whitespace
9-
string.lowercase
10-
string.uppercase
11-
string.letters
9+
string.ascii_lowercase
10+
string.ascii_uppercase
11+
string.ascii_letters
1212
string.digits
1313
string.hexdigits
1414
string.octdigits

Misc/NEWS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ Library
202202
- Remove obsolete functions:
203203
* commands.getstatus(), os.popen*,
204204

205-
- Remove functions in the string module that are also string methods.
205+
- Remove functions in the string module that are also string methods;
206+
Remove string.{letters, lowercase, uppercase}.
206207

207208
- Remove support for long obsolete platforms: plat-aix3, plat-irix5.
208209

Tools/modulator/modulator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030

3131
oops = 'oops'
3232

33-
IDENTSTARTCHARS = string.letters + '_'
34-
IDENTCHARS = string.letters + string.digits + '_'
33+
IDENTSTARTCHARS = string.ascii_letters + '_'
34+
IDENTCHARS = string.ascii_letters + string.digits + '_'
3535

3636
# Check that string is a legal C identifier
3737
def checkid(str):

Tools/scripts/texi2html.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2000,7 +2000,7 @@ def fixfunnychars(addr):
20002000
def increment(s):
20012001
if not s:
20022002
return '1'
2003-
for sequence in string.digits, string.lowercase, string.uppercase:
2003+
for sequence in string.digits, string.ascii_lowercase, string.ascii_uppercase:
20042004
lastc = s[-1]
20052005
if lastc in sequence:
20062006
i = sequence.index(lastc) + 1

0 commit comments

Comments
 (0)