Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
a34cd0c7
Commit
a34cd0c7
authored
Nov 15, 2014
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #22824: Simplify reprlib output format for empty arrays
parent
5d438339
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
1 deletion
+6
-1
Lib/reprlib.py
Lib/reprlib.py
+2
-0
Lib/test/test_reprlib.py
Lib/test/test_reprlib.py
+1
-1
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/reprlib.py
View file @
a34cd0c7
...
...
@@ -83,6 +83,8 @@ class Repr:
return
self
.
_repr_iterable
(
x
,
level
,
'['
,
']'
,
self
.
maxlist
)
def
repr_array
(
self
,
x
,
level
):
if
not
x
:
return
"array('%s')"
%
x
.
typecode
header
=
"array('%s', ["
%
x
.
typecode
return
self
.
_repr_iterable
(
x
,
level
,
header
,
'])'
,
self
.
maxarray
)
...
...
Lib/test/test_reprlib.py
View file @
a34cd0c7
...
...
@@ -94,7 +94,7 @@ class ReprTests(unittest.TestCase):
eq
(
r
(
d
),
"{'alice': 1, 'arthur': 1, 'bob': 2, 'charles': 3, ...}"
)
# array.array after 5.
eq
(
r
(
array
(
'i'
)),
"array('i'
, []
)"
)
eq
(
r
(
array
(
'i'
)),
"array('i')"
)
eq
(
r
(
array
(
'i'
,
[
1
])),
"array('i', [1])"
)
eq
(
r
(
array
(
'i'
,
[
1
,
2
])),
"array('i', [1, 2])"
)
eq
(
r
(
array
(
'i'
,
[
1
,
2
,
3
])),
"array('i', [1, 2, 3])"
)
...
...
Misc/NEWS
View file @
a34cd0c7
...
...
@@ -209,6 +209,9 @@ Library
-
Issue
#
22824
:
Updated
reprlib
output
format
for
sets
to
use
set
literals
.
Patch
contributed
by
Berker
Peksag
.
-
Issue
#
22824
:
Updated
reprlib
output
format
for
arrays
to
display
empty
arrays
without
an
unnecessary
empty
list
.
Suggested
by
Serhiy
Storchaka
.
-
Issue
#
22406
:
Fixed
the
uu_codec
codec
incorrectly
ported
to
3.
x
.
Based
on
patch
by
Martin
Panter
.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment