Skip to content

Commit 471b914

Browse files
authored
Merge pull request matplotlib#20769 from anntzer/psnts
Simplify backend_ps._nums_to_str.
2 parents da309ec + 651df81 commit 471b914

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

lib/matplotlib/backends/backend_ps.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -88,22 +88,8 @@ def _get_papertype(w, h):
8888
return 'a0'
8989

9090

91-
def _num_to_str(val):
92-
if isinstance(val, str):
93-
return val
94-
95-
ival = int(val)
96-
if val == ival:
97-
return str(ival)
98-
99-
s = "%1.3f" % val
100-
s = s.rstrip("0")
101-
s = s.rstrip(".")
102-
return s
103-
104-
10591
def _nums_to_str(*args):
106-
return ' '.join(map(_num_to_str, args))
92+
return " ".join(f"{arg:1.3f}".rstrip("0").rstrip(".") for arg in args)
10793

10894

10995
def quote_ps_string(s):

0 commit comments

Comments
 (0)