summaryrefslogtreecommitdiff
path: root/numpy/core/records.py
diff options
context:
space:
mode:
authorRoman Yurchak <rth.yurchak@pm.me>2018-12-01 19:03:55 +0100
committerCharles Harris <charlesr.harris@gmail.com>2018-12-01 10:03:55 -0800
commit0ee245bc6df60b911fafe81a743ec2a68a063c20 (patch)
tree4b32a0091c206d64ceda3f51ea134661dcaff513 /numpy/core/records.py
parent69addfdfeee4226f723bb1f8d6f583221725319a (diff)
downloadnumpy-0ee245bc6df60b911fafe81a743ec2a68a063c20.tar.gz
MAINT: Use list and dict comprehension when possible (#12445)
* Use list comprehension * More list comprehension migration * Revert key copying in dict * A few more fixes * More reverts * Use dict comprehension * Fix dict comprehension * Address review comments * More review comments * Fix for empty unpacking of zip(* * Revert zip(* unpacking altogether * Fix dict copying * More simplifications
Diffstat (limited to 'numpy/core/records.py')
-rw-r--r--numpy/core/records.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/numpy/core/records.py b/numpy/core/records.py
index 6fc282500..9e09e46b3 100644
--- a/numpy/core/records.py
+++ b/numpy/core/records.py
@@ -290,10 +290,8 @@ class record(nt.void):
# pretty-print all fields
names = self.dtype.names
maxlen = max(len(name) for name in names)
- rows = []
fmt = '%% %ds: %%s' % maxlen
- for name in names:
- rows.append(fmt % (name, getattr(self, name)))
+ rows = [fmt % (name, getattr(self, name)) for name in names]
return "\n".join(rows)
# The recarray is almost identical to a standard array (which supports