summaryrefslogtreecommitdiffstats
path: root/Lib/fpformat.py
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2004-02-12 17:35:32 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2004-02-12 17:35:32 (GMT)
commit70a6b49821a3226f55e9716f32d802d06640cb89 (patch)
tree3c8ca10c1fa09e025bd266cf855a00d7d96c55aa /Lib/fpformat.py
parentecfeb7f095dfd9c1c8929bf3df858ee35e0d9e9e (diff)
downloadcpython-70a6b49821a3226f55e9716f32d802d06640cb89.zip
cpython-70a6b49821a3226f55e9716f32d802d06640cb89.tar.gz
cpython-70a6b49821a3226f55e9716f32d802d06640cb89.tar.bz2
Replace backticks with repr() or "%r"
From SF patch #852334.
Diffstat (limited to 'Lib/fpformat.py')
-rw-r--r--Lib/fpformat.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/fpformat.py b/Lib/fpformat.py
index 7319e2a..0ae86a9 100644
--- a/Lib/fpformat.py
+++ b/Lib/fpformat.py
@@ -88,7 +88,7 @@ def fix(x, digs):
"""Format x as [-]ddd.ddd with 'digs' digits after the point
and at least one digit before.
If digs <= 0, the point is suppressed."""
- if type(x) != type(''): x = `x`
+ if type(x) != type(''): x = repr(x)
try:
sign, intpart, fraction, expo = extract(x)
except NotANumber:
@@ -104,7 +104,7 @@ def sci(x, digs):
"""Format x as [-]d.dddE[+-]ddd with 'digs' digits after the point
and exactly one digit before.
If digs is <= 0, one digit is kept and the point is suppressed."""
- if type(x) != type(''): x = `x`
+ if type(x) != type(''): x = repr(x)
sign, intpart, fraction, expo = extract(x)
if not intpart:
while fraction and fraction[0] == '0':
@@ -126,7 +126,7 @@ def sci(x, digs):
expo + len(intpart) - 1
s = sign + intpart
if digs > 0: s = s + '.' + fraction
- e = `abs(expo)`
+ e = repr(abs(expo))
e = '0'*(3-len(e)) + e
if expo < 0: e = '-' + e
else: e = '+' + e