Replace backticks with repr() or "%r"

From SF patch #852334.
diff --git a/Lib/BaseHTTPServer.py b/Lib/BaseHTTPServer.py
index 15e7525..27ac513 100644
--- a/Lib/BaseHTTPServer.py
+++ b/Lib/BaseHTTPServer.py
@@ -238,7 +238,7 @@
         if len(words) == 3:
             [command, path, version] = words
             if version[:5] != 'HTTP/':
-                self.send_error(400, "Bad request version (%s)" % `version`)
+                self.send_error(400, "Bad request version (%r)" % version)
                 return False
             try:
                 base_version_number = version.split('/', 1)[1]
@@ -253,7 +253,7 @@
                     raise ValueError
                 version_number = int(version_number[0]), int(version_number[1])
             except (ValueError, IndexError):
-                self.send_error(400, "Bad request version (%s)" % `version`)
+                self.send_error(400, "Bad request version (%r)" % version)
                 return False
             if version_number >= (1, 1) and self.protocol_version >= "HTTP/1.1":
                 self.close_connection = 0
@@ -266,12 +266,12 @@
             self.close_connection = 1
             if command != 'GET':
                 self.send_error(400,
-                                "Bad HTTP/0.9 request type (%s)" % `command`)
+                                "Bad HTTP/0.9 request type (%r)" % command)
                 return False
         elif not words:
             return False
         else:
-            self.send_error(400, "Bad request syntax (%s)" % `requestline`)
+            self.send_error(400, "Bad request syntax (%r)" % requestline)
             return False
         self.command, self.path, self.request_version = command, path, version
 
@@ -302,7 +302,7 @@
             return
         mname = 'do_' + self.command
         if not hasattr(self, mname):
-            self.send_error(501, "Unsupported method (%s)" % `self.command`)
+            self.send_error(501, "Unsupported method (%r)" % self.command)
             return
         method = getattr(self, mname)
         method()
diff --git a/Lib/Bastion.py b/Lib/Bastion.py
index ae2db74..58cce97 100644
--- a/Lib/Bastion.py
+++ b/Lib/Bastion.py
@@ -124,7 +124,7 @@
         return get1(name)
 
     if name is None:
-        name = `object`
+        name = repr(object)
     return bastionclass(get2, name)
 
 
diff --git a/Lib/CGIHTTPServer.py b/Lib/CGIHTTPServer.py
index 7f481b7..52e04e9 100644
--- a/Lib/CGIHTTPServer.py
+++ b/Lib/CGIHTTPServer.py
@@ -117,21 +117,21 @@
         scriptname = dir + '/' + script
         scriptfile = self.translate_path(scriptname)
         if not os.path.exists(scriptfile):
-            self.send_error(404, "No such CGI script (%s)" % `scriptname`)
+            self.send_error(404, "No such CGI script (%r)" % scriptname)
             return
         if not os.path.isfile(scriptfile):
-            self.send_error(403, "CGI script is not a plain file (%s)" %
-                            `scriptname`)
+            self.send_error(403, "CGI script is not a plain file (%r)" % 
+                            scriptname)
             return
         ispy = self.is_python(scriptname)
         if not ispy:
             if not (self.have_fork or self.have_popen2 or self.have_popen3):
-                self.send_error(403, "CGI script is not a Python script (%s)" %
-                                `scriptname`)
+                self.send_error(403, "CGI script is not a Python script (%r)" %
+                                scriptname)
                 return
             if not self.is_executable(scriptfile):
-                self.send_error(403, "CGI script is not executable (%s)" %
-                                `scriptname`)
+                self.send_error(403, "CGI script is not executable (%r)" %
+                                scriptname)
                 return
 
         # Reference: http://hoohoo.ncsa.uiuc.edu/cgi/env.html
diff --git a/Lib/ConfigParser.py b/Lib/ConfigParser.py
index d98993a..e12717d 100644
--- a/Lib/ConfigParser.py
+++ b/Lib/ConfigParser.py
@@ -118,7 +118,7 @@
     """Raised when no section matches a requested option."""
 
     def __init__(self, section):
-        Error.__init__(self, 'No section: ' + `section`)
+        Error.__init__(self, 'No section: %r' % (section,))
         self.section = section
 
 class DuplicateSectionError(Error):
@@ -191,7 +191,7 @@
     def __init__(self, filename, lineno, line):
         Error.__init__(
             self,
-            'File contains no section headers.\nfile: %s, line: %d\n%s' %
+            'File contains no section headers.\nfile: %s, line: %d\n%r' %
             (filename, lineno, line))
         self.filename = filename
         self.lineno = lineno
@@ -453,7 +453,7 @@
                     optname = None
                 # no section header in the file?
                 elif cursect is None:
-                    raise MissingSectionHeaderError(fpname, lineno, `line`)
+                    raise MissingSectionHeaderError(fpname, lineno, line)
                 # an option line?
                 else:
                     mo = self.OPTCRE.match(line)
@@ -478,7 +478,7 @@
                         # list of all bogus lines
                         if not e:
                             e = ParsingError(fpname)
-                        e.append(lineno, `line`)
+                        e.append(lineno, repr(line))
         # if any parsing errors occurred, raise an exception
         if e:
             raise e
@@ -613,4 +613,4 @@
             else:
                 raise InterpolationSyntaxError(
                     option, section,
-                    "'%' must be followed by '%' or '(', found: " + `rest`)
+                    "'%%' must be followed by '%%' or '(', found: %r" % (rest,))
diff --git a/Lib/HTMLParser.py b/Lib/HTMLParser.py
index c082fde..7334581 100644
--- a/Lib/HTMLParser.py
+++ b/Lib/HTMLParser.py
@@ -272,8 +272,8 @@
                          - self.__starttag_text.rfind("\n")
             else:
                 offset = offset + len(self.__starttag_text)
-            self.error("junk characters in start tag: %s"
-                       % `rawdata[k:endpos][:20]`)
+            self.error("junk characters in start tag: %r"
+                       % (rawdata[k:endpos][:20],))
         if end.endswith('/>'):
             # XHTML-style empty tag: <span attr="value" />
             self.handle_startendtag(tag, attrs)
@@ -324,7 +324,7 @@
         j = match.end()
         match = endtagfind.match(rawdata, i) # </ + tag + >
         if not match:
-            self.error("bad end tag: %s" % `rawdata[i:j]`)
+            self.error("bad end tag: %r" % (rawdata[i:j],))
         tag = match.group(1)
         self.handle_endtag(tag.lower())
         self.clear_cdata_mode()
@@ -368,7 +368,7 @@
         pass
 
     def unknown_decl(self, data):
-        self.error("unknown declaration: " + `data`)
+        self.error("unknown declaration: %r" % (data,))
 
     # Internal -- helper to remove special character quoting
     def unescape(self, s):
diff --git a/Lib/StringIO.py b/Lib/StringIO.py
index 4739d13..f35054e 100644
--- a/Lib/StringIO.py
+++ b/Lib/StringIO.py
@@ -222,10 +222,10 @@
     f.seek(len(lines[0]))
     f.write(lines[1])
     f.seek(0)
-    print 'First line =', `f.readline()`
+    print 'First line =', repr(f.readline())
     print 'Position =', f.tell()
     line = f.readline()
-    print 'Second line =', `line`
+    print 'Second line =', repr(line)
     f.seek(-len(line), 1)
     line2 = f.read(len(line))
     if line != line2:
diff --git a/Lib/aifc.py b/Lib/aifc.py
index 0275e42..781d77c 100644
--- a/Lib/aifc.py
+++ b/Lib/aifc.py
@@ -392,7 +392,7 @@
         for marker in self._markers:
             if id == marker[0]:
                 return marker
-        raise Error, 'marker ' + `id` + ' does not exist'
+        raise Error, 'marker %r does not exist' % (id,)
 
     def setpos(self, pos):
         if pos < 0 or pos > self._nframes:
@@ -697,7 +697,7 @@
         for marker in self._markers:
             if id == marker[0]:
                 return marker
-        raise Error, 'marker ' + `id` + ' does not exist'
+        raise Error, 'marker %r does not exist' % (id,)
 
     def getmarkers(self):
         if len(self._markers) == 0:
diff --git a/Lib/atexit.py b/Lib/atexit.py
index 59d5cf3..85ccb24 100644
--- a/Lib/atexit.py
+++ b/Lib/atexit.py
@@ -40,9 +40,9 @@
     def x1():
         print "running x1"
     def x2(n):
-        print "running x2(%s)" % `n`
+        print "running x2(%r)" % (n,)
     def x3(n, kwd=None):
-        print "running x3(%s, kwd=%s)" % (`n`, `kwd`)
+        print "running x3(%r, kwd=%r)" % (n, kwd)
 
     register(x1)
     register(x2, 12)
diff --git a/Lib/base64.py b/Lib/base64.py
index 54ee623..f90b91d 100755
--- a/Lib/base64.py
+++ b/Lib/base64.py
@@ -348,7 +348,7 @@
     s0 = "Aladdin:open sesame"
     s1 = encodestring(s0)
     s2 = decodestring(s1)
-    print s0, `s1`, s2
+    print s0, repr(s1), s2
 
 
 if __name__ == '__main__':
diff --git a/Lib/bdb.py b/Lib/bdb.py
index 45e9d03..11ed212 100644
--- a/Lib/bdb.py
+++ b/Lib/bdb.py
@@ -52,7 +52,7 @@
             return self.dispatch_return(frame, arg)
         if event == 'exception':
             return self.dispatch_exception(frame, arg)
-        print 'bdb.Bdb.dispatch: unknown debugging event:', `event`
+        print 'bdb.Bdb.dispatch: unknown debugging event:', repr(event)
         return self.trace_dispatch
 
     def dispatch_line(self, frame):
@@ -311,7 +311,7 @@
         import linecache, repr
         frame, lineno = frame_lineno
         filename = self.canonic(frame.f_code.co_filename)
-        s = filename + '(' + `lineno` + ')'
+        s = '%s(%r)' % (filename, lineno)
         if frame.f_code.co_name:
             s = s + frame.f_code.co_name
         else:
diff --git a/Lib/binhex.py b/Lib/binhex.py
index 5700659..9735f2e 100644
--- a/Lib/binhex.py
+++ b/Lib/binhex.py
@@ -229,7 +229,7 @@
 
     def close_data(self):
         if self.dlen != 0:
-            raise Error, 'Incorrect data size, diff='+`self.rlen`
+            raise Error, 'Incorrect data size, diff=%r' % (self.rlen,)
         self._writecrc()
         self.state = _DID_DATA
 
@@ -248,7 +248,7 @@
             raise Error, 'Close at the wrong time'
         if self.rlen != 0:
             raise Error, \
-                  "Incorrect resource-datasize, diff="+`self.rlen`
+                  "Incorrect resource-datasize, diff=%r" % (self.rlen,)
         self._writecrc()
         self.ofp.close()
         self.state = None
diff --git a/Lib/bsddb/dbrecio.py b/Lib/bsddb/dbrecio.py
index 470fb41..22e382a 100644
--- a/Lib/bsddb/dbrecio.py
+++ b/Lib/bsddb/dbrecio.py
@@ -164,10 +164,10 @@
     f.seek(len(lines[0]))
     f.write(lines[1])
     f.seek(0)
-    print 'First line =', `f.readline()`
+    print 'First line =', repr(f.readline())
     here = f.tell()
     line = f.readline()
-    print 'Second line =', `line`
+    print 'Second line =', repr(line)
     f.seek(-len(line), 1)
     line2 = f.read(len(line))
     if line != line2:
diff --git a/Lib/bsddb/dbtables.py b/Lib/bsddb/dbtables.py
index 6edfd29..e1d2c43 100644
--- a/Lib/bsddb/dbtables.py
+++ b/Lib/bsddb/dbtables.py
@@ -206,7 +206,7 @@
         try:
             key, data = cur.first()
             while 1:
-                print `{key: data}`
+                print repr({key: data})
                 next = cur.next()
                 if next:
                     key, data = next
@@ -341,9 +341,9 @@
         try:
             tcolpickles = self.db.get(_columns_key(table))
         except DBNotFoundError:
-            raise TableDBError, "unknown table: " + `table`
+            raise TableDBError, "unknown table: %r" % (table,)
         if not tcolpickles:
-            raise TableDBError, "unknown table: " + `table`
+            raise TableDBError, "unknown table: %r" % (table,)
         self.__tablecolumns[table] = pickle.loads(tcolpickles)
 
     def __new_rowid(self, table, txn) :
@@ -384,7 +384,7 @@
                 self.__load_column_info(table)
             for column in rowdict.keys() :
                 if not self.__tablecolumns[table].count(column):
-                    raise TableDBError, "unknown column: "+`column`
+                    raise TableDBError, "unknown column: %r" % (column,)
 
             # get a unique row identifier for this row
             txn = self.env.txn_begin()
@@ -535,7 +535,7 @@
             columns = self.tablecolumns[table]
         for column in (columns + conditions.keys()):
             if not self.__tablecolumns[table].count(column):
-                raise TableDBError, "unknown column: "+`column`
+                raise TableDBError, "unknown column: %r" % (column,)
 
         # keyed on rows that match so far, containings dicts keyed on
         # column names containing the data for that row and column.
diff --git a/Lib/bsddb/test/test_associate.py b/Lib/bsddb/test/test_associate.py
index f810eb0..fc92c22 100644
--- a/Lib/bsddb/test/test_associate.py
+++ b/Lib/bsddb/test/test_associate.py
@@ -200,7 +200,7 @@
     def getGenre(self, priKey, priData):
         assert type(priData) == type("")
         if verbose:
-            print 'getGenre key:', `priKey`, 'data:', `priData`
+            print 'getGenre key: %r data: %r' % (priKey, priData)
         genre = string.split(priData, '|')[2]
         if genre == 'Blues':
             return db.DB_DONOTINDEX
@@ -242,7 +242,7 @@
     def getGenre(self, priKey, priData):
         assert type(priData) == type(())
         if verbose:
-            print 'getGenre key:', `priKey`, 'data:', `priData`
+            print 'getGenre key: %r data: %r' % (priKey, priData)
         genre = priData[2]
         if genre == 'Blues':
             return db.DB_DONOTINDEX
diff --git a/Lib/bsddb/test/test_basics.py b/Lib/bsddb/test/test_basics.py
index d757b34..da7e18f 100644
--- a/Lib/bsddb/test/test_basics.py
+++ b/Lib/bsddb/test/test_basics.py
@@ -361,7 +361,7 @@
             if set_raises_error:
                 self.fail("expected exception")
             if n != None:
-                self.fail("expected None: "+`n`)
+                self.fail("expected None: %r" % (n,))
 
         rec = c.get_both('0404', self.makeData('0404'))
         assert rec == ('0404', self.makeData('0404'))
@@ -375,7 +375,7 @@
             if get_raises_error:
                 self.fail("expected exception")
             if n != None:
-                self.fail("expected None: "+`n`)
+                self.fail("expected None: %r" % (n,))
 
         if self.d.get_type() == db.DB_BTREE:
             rec = c.set_range('011')
@@ -548,7 +548,7 @@
         num = d.truncate()
         assert num >= 1, "truncate returned <= 0 on non-empty database"
         num = d.truncate()
-        assert num == 0, "truncate on empty DB returned nonzero (%s)" % `num`
+        assert num == 0, "truncate on empty DB returned nonzero (%r)" % (num,)
 
 #----------------------------------------------------------------------
 
@@ -674,7 +674,7 @@
         num = d.truncate(txn)
         assert num >= 1, "truncate returned <= 0 on non-empty database"
         num = d.truncate(txn)
-        assert num == 0, "truncate on empty DB returned nonzero (%s)" % `num`
+        assert num == 0, "truncate on empty DB returned nonzero (%r)" % (num,)
         txn.commit()
 
     #----------------------------------------
diff --git a/Lib/bsddb/test/test_dbtables.py b/Lib/bsddb/test/test_dbtables.py
index eb5758f..1128a5a 100644
--- a/Lib/bsddb/test/test_dbtables.py
+++ b/Lib/bsddb/test/test_dbtables.py
@@ -109,7 +109,7 @@
             assert values[1]['Species'] == 'Penguin'
         else :
             if verbose:
-                print "values=", `values`
+                print "values= %r" % (values,)
             raise "Wrong values returned!"
 
     def test03(self):
diff --git a/Lib/calendar.py b/Lib/calendar.py
index fb56826..321059d 100644
--- a/Lib/calendar.py
+++ b/Lib/calendar.py
@@ -151,9 +151,9 @@
     """Return a month's calendar string (multi-line)."""
     w = max(2, w)
     l = max(1, l)
-    s = ((month_name[themonth] + ' ' + `theyear`).center(
-                 7 * (w + 1) - 1).rstrip() +
-         '\n' * l + weekheader(w).rstrip() + '\n' * l)
+    s = ("%s %r" % (month_name[themonth], theyear)).center(
+                 7 * (w + 1) - 1).rstrip() + \
+         '\n' * l + weekheader(w).rstrip() + '\n' * l
     for aweek in monthcalendar(theyear, themonth):
         s = s + week(aweek, w).rstrip() + '\n' * l
     return s[:-l] + '\n'
@@ -181,7 +181,7 @@
     l = max(1, l)
     c = max(2, c)
     colwidth = (w + 1) * 7 - 1
-    s = `year`.center(colwidth * 3 + c * 2).rstrip() + '\n' * l
+    s = repr(year).center(colwidth * 3 + c * 2).rstrip() + '\n' * l
     header = weekheader(w)
     header = format3cstring(header, header, header, colwidth, c).rstrip()
     for q in range(January, January+12, 3):
diff --git a/Lib/cgi.py b/Lib/cgi.py
index ac7192b..2576e75 100755
--- a/Lib/cgi.py
+++ b/Lib/cgi.py
@@ -212,7 +212,7 @@
         nv = name_value.split('=', 1)
         if len(nv) != 2:
             if strict_parsing:
-                raise ValueError, "bad query field: %s" % `name_value`
+                raise ValueError, "bad query field: %r" % (name_value,)
             continue
         if len(nv[1]) or keep_blank_values:
             name = urllib.unquote(nv[0].replace('+', ' '))
@@ -247,8 +247,8 @@
     if 'boundary' in pdict:
         boundary = pdict['boundary']
     if not valid_boundary(boundary):
-        raise ValueError,  ('Invalid boundary in multipart form: %s'
-                            % `boundary`)
+        raise ValueError,  ('Invalid boundary in multipart form: %r'
+                            % (boundary,))
 
     nextpart = "--" + boundary
     lastpart = "--" + boundary + "--"
@@ -361,7 +361,7 @@
 
     def __repr__(self):
         """Return printable representation."""
-        return "MiniFieldStorage(%s, %s)" % (`self.name`, `self.value`)
+        return "MiniFieldStorage(%r, %r)" % (self.name, self.value)
 
 
 class FieldStorage:
@@ -522,8 +522,8 @@
 
     def __repr__(self):
         """Return a printable representation."""
-        return "FieldStorage(%s, %s, %s)" % (
-                `self.name`, `self.filename`, `self.value`)
+        return "FieldStorage(%r, %r, %r)" % (
+                self.name, self.filename, self.value)
 
     def __iter__(self):
         return iter(self.keys())
@@ -632,8 +632,7 @@
         """Internal: read a part that is itself multipart."""
         ib = self.innerboundary
         if not valid_boundary(ib):
-            raise ValueError, ('Invalid boundary in multipart form: %s'
-                               % `ib`)
+            raise ValueError, 'Invalid boundary in multipart form: %r' % (ib,)
         self.list = []
         klass = self.FieldStorageClass or self.__class__
         part = klass(self.fp, {}, ib,
@@ -957,8 +956,8 @@
     for key in keys:
         print "<DT>" + escape(key) + ":",
         value = form[key]
-        print "<i>" + escape(`type(value)`) + "</i>"
-        print "<DD>" + escape(`value`)
+        print "<i>" + escape(repr(type(value))) + "</i>"
+        print "<DD>" + escape(repr(value))
     print "</DL>"
     print
 
diff --git a/Lib/difflib.py b/Lib/difflib.py
index 699845c..c074b19 100644
--- a/Lib/difflib.py
+++ b/Lib/difflib.py
@@ -689,9 +689,9 @@
     """
 
     if not n >  0:
-        raise ValueError("n must be > 0: " + `n`)
+        raise ValueError("n must be > 0: %r" % (n,))
     if not 0.0 <= cutoff <= 1.0:
-        raise ValueError("cutoff must be in [0.0, 1.0]: " + `cutoff`)
+        raise ValueError("cutoff must be in [0.0, 1.0]: %r" % (cutoff,))
     result = []
     s = SequenceMatcher()
     s.set_seq2(word)
@@ -876,7 +876,7 @@
             elif tag == 'equal':
                 g = self._dump(' ', a, alo, ahi)
             else:
-                raise ValueError, 'unknown tag ' + `tag`
+                raise ValueError, 'unknown tag %r' % (tag,)
 
             for line in g:
                 yield line
@@ -988,7 +988,7 @@
                     atags += ' ' * la
                     btags += ' ' * lb
                 else:
-                    raise ValueError, 'unknown tag ' + `tag`
+                    raise ValueError, 'unknown tag %r' % (tag,)
             for line in self._qformat(aelt, belt, atags, btags):
                 yield line
         else:
diff --git a/Lib/dis.py b/Lib/dis.py
index 3208011..5a74b3a 100644
--- a/Lib/dis.py
+++ b/Lib/dis.py
@@ -80,7 +80,7 @@
         else: print '   ',
         if i in labels: print '>>',
         else: print '  ',
-        print `i`.rjust(4),
+        print repr(i).rjust(4),
         print opname[op].ljust(20),
         i = i+1
         if op >= HAVE_ARGUMENT:
@@ -89,13 +89,13 @@
             i = i+2
             if op == EXTENDED_ARG:
                 extended_arg = oparg*65536L
-            print `oparg`.rjust(5),
+            print repr(oparg).rjust(5),
             if op in hasconst:
-                print '(' + `co.co_consts[oparg]` + ')',
+                print '(' + repr(co.co_consts[oparg]) + ')',
             elif op in hasname:
                 print '(' + co.co_names[oparg] + ')',
             elif op in hasjrel:
-                print '(to ' + `i + oparg` + ')',
+                print '(to ' + repr(i + oparg) + ')',
             elif op in haslocal:
                 print '(' + co.co_varnames[oparg] + ')',
             elif op in hascompare:
@@ -118,16 +118,16 @@
         else: print '   ',
         if i in labels: print '>>',
         else: print '  ',
-        print `i`.rjust(4),
+        print repr(i).rjust(4),
         print opname[op].ljust(15),
         i = i+1
         if op >= HAVE_ARGUMENT:
             oparg = ord(code[i]) + ord(code[i+1])*256
             i = i+2
-            print `oparg`.rjust(5),
+            print repr(oparg).rjust(5),
             if op in hasconst:
                 if constants:
-                    print '(' + `constants[oparg]` + ')',
+                    print '(' + repr(constants[oparg]) + ')',
                 else:
                     print '(%d)'%oparg,
             elif op in hasname:
@@ -136,7 +136,7 @@
                 else:
                     print '(%d)'%oparg,
             elif op in hasjrel:
-                print '(to ' + `i + oparg` + ')',
+                print '(to ' + repr(i + oparg) + ')',
             elif op in haslocal:
                 if varnames:
                     print '(' + varnames[oparg] + ')',
diff --git a/Lib/distutils/cmd.py b/Lib/distutils/cmd.py
index 6e44221..fef4939 100644
--- a/Lib/distutils/cmd.py
+++ b/Lib/distutils/cmd.py
@@ -253,8 +253,8 @@
 
             if not ok:
                 raise DistutilsOptionError, \
-                      "'%s' must be a list of strings (got %s)" % \
-                      (option, `val`)
+                      "'%s' must be a list of strings (got %r)" % \
+                      (option, val)
 
     def _ensure_tested_string (self, option, tester,
                                what, error_fmt, default=None):
diff --git a/Lib/distutils/core.py b/Lib/distutils/core.py
index a463272..eb41972 100644
--- a/Lib/distutils/core.py
+++ b/Lib/distutils/core.py
@@ -202,7 +202,7 @@
     used to drive the Distutils.
     """
     if stop_after not in ('init', 'config', 'commandline', 'run'):
-        raise ValueError, "invalid value for 'stop_after': %s" % `stop_after`
+        raise ValueError, "invalid value for 'stop_after': %r" % (stop_after,)
 
     global _setup_stop_after, _setup_distribution
     _setup_stop_after = stop_after
diff --git a/Lib/distutils/dir_util.py b/Lib/distutils/dir_util.py
index bd1ea0f..e479b62 100644
--- a/Lib/distutils/dir_util.py
+++ b/Lib/distutils/dir_util.py
@@ -33,7 +33,7 @@
     # Detect a common bug -- name is None
     if type(name) is not StringType:
         raise DistutilsInternalError, \
-              "mkpath: 'name' must be a string (got %s)" % `name`
+              "mkpath: 'name' must be a string (got %r)" % (name,)
 
     # XXX what's the better way to handle verbosity? print as we create
     # each directory in the path (the current behaviour), or only announce
diff --git a/Lib/distutils/dist.py b/Lib/distutils/dist.py
index d313e7d..f63ea97 100644
--- a/Lib/distutils/dist.py
+++ b/Lib/distutils/dist.py
@@ -525,9 +525,9 @@
                         func()
                     else:
                         raise DistutilsClassError(
-                            "invalid help function %s for help option '%s': "
+                            "invalid help function %r for help option '%s': "
                             "must be a callable object (function, etc.)"
-                            % (`func`, help_option))
+                            % (func, help_option))
 
             if help_option_found:
                 return
diff --git a/Lib/distutils/fancy_getopt.py b/Lib/distutils/fancy_getopt.py
index a4a4e79..512bc9b 100644
--- a/Lib/distutils/fancy_getopt.py
+++ b/Lib/distutils/fancy_getopt.py
@@ -162,7 +162,7 @@
             else:
                 # the option table is part of the code, so simply
                 # assert that it is correct
-                assert "invalid option tuple: %s" % `option`
+                assert "invalid option tuple: %r" % (option,)
 
             # Type- and value-check the option names
             if type(long) is not StringType or len(long) < 2:
diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py
index dc3183b..8c3c8df 100644
--- a/Lib/distutils/util.py
+++ b/Lib/distutils/util.py
@@ -285,7 +285,7 @@
     print.
     """
     if msg is None:
-        msg = "%s%s" % (func.__name__, `args`)
+        msg = "%s%r" % (func.__name__, args)
         if msg[-2:] == ',)':        # correct for singleton tuple
             msg = msg[0:-2] + ')'
 
@@ -307,7 +307,7 @@
     elif val in ('n', 'no', 'f', 'false', 'off', '0'):
         return 0
     else:
-        raise ValueError, "invalid truth value %s" % `val`
+        raise ValueError, "invalid truth value %r" % (val,)
 
 
 def byte_compile (py_files,
@@ -394,11 +394,11 @@
 
             script.write(string.join(map(repr, py_files), ",\n") + "]\n")
             script.write("""
-byte_compile(files, optimize=%s, force=%s,
-             prefix=%s, base_dir=%s,
-             verbose=%s, dry_run=0,
+byte_compile(files, optimize=%r, force=%r,
+             prefix=%r, base_dir=%r,
+             verbose=%r, dry_run=0,
              direct=1)
-""" % (`optimize`, `force`, `prefix`, `base_dir`, `verbose`))
+""" % (optimize, force, prefix, base_dir, verbose))
 
             script.close()
 
@@ -432,8 +432,8 @@
             if prefix:
                 if file[:len(prefix)] != prefix:
                     raise ValueError, \
-                          ("invalid prefix: filename %s doesn't start with %s"
-                           % (`file`, `prefix`))
+                          ("invalid prefix: filename %r doesn't start with %r"
+                           % (file, prefix))
                 dfile = dfile[len(prefix):]
             if base_dir:
                 dfile = os.path.join(base_dir, dfile)
diff --git a/Lib/doctest.py b/Lib/doctest.py
index caac691..5020684 100644
--- a/Lib/doctest.py
+++ b/Lib/doctest.py
@@ -334,8 +334,8 @@
             continue
         lineno = i - 1
         if line[j] != " ":
-            raise ValueError("line " + `lineno` + " of docstring lacks "
-                "blank after " + PS1 + ": " + line)
+            raise ValueError("line %r of docstring lacks blank after %s: %s" %
+                             (lineno, PS1, line))
         j = j + 1
         blanks = m.group(1)
         nblanks = len(blanks)
@@ -348,7 +348,7 @@
             if m:
                 if m.group(1) != blanks:
                     raise ValueError("inconsistent leading whitespace "
-                        "in line " + `i` + " of docstring: " + line)
+                        "in line %r of docstring: %s" % (i, line))
                 i = i + 1
             else:
                 break
@@ -367,7 +367,7 @@
             while 1:
                 if line[:nblanks] != blanks:
                     raise ValueError("inconsistent leading whitespace "
-                        "in line " + `i` + " of docstring: " + line)
+                        "in line %r of docstring: %s" % (i, line))
                 expect.append(line[nblanks:])
                 i = i + 1
                 line = lines[i]
@@ -475,7 +475,7 @@
         failures = failures + 1
         out("*" * 65 + "\n")
         _tag_out(out, ("Failure in example", source))
-        out("from line #" + `lineno` + " of " + name + "\n")
+        out("from line #%r of %s\n" % (lineno, name))
         if state == FAIL:
             _tag_out(out, ("Expected", want or NADA), ("Got", got))
         else:
@@ -686,8 +686,7 @@
         if mod is None and globs is None:
             raise TypeError("Tester.__init__: must specify mod or globs")
         if mod is not None and not _ismodule(mod):
-            raise TypeError("Tester.__init__: mod must be a module; " +
-                            `mod`)
+            raise TypeError("Tester.__init__: mod must be a module; %r" % (mod,))
         if globs is None:
             globs = mod.__dict__
         self.globs = globs
@@ -775,7 +774,7 @@
                 name = object.__name__
             except AttributeError:
                 raise ValueError("Tester.rundoc: name must be given "
-                    "when object.__name__ doesn't exist; " + `object`)
+                    "when object.__name__ doesn't exist; %r" % (object,))
         if self.verbose:
             print "Running", name + ".__doc__"
         f, t = run_docstring_examples(object, self.globs, self.verbose, name,
@@ -893,8 +892,7 @@
         """
 
         if not hasattr(d, "items"):
-            raise TypeError("Tester.rundict: d must support .items(); " +
-                            `d`)
+            raise TypeError("Tester.rundict: d must support .items(); %r" % (d,))
         f = t = 0
         # Run the tests by alpha order of names, for consistency in
         # verbose-mode output.
@@ -936,7 +934,7 @@
                 else:
                     raise TypeError("Tester.run__test__: values in "
                             "dict must be strings, functions, methods, "
-                            "or classes; " + `v`)
+                            "or classes; %r" % (v,))
                 failures = failures + f
                 tries = tries + t
         finally:
@@ -1139,7 +1137,7 @@
         m = sys.modules.get('__main__')
 
     if not _ismodule(m):
-        raise TypeError("testmod: module required; " + `m`)
+        raise TypeError("testmod: module required; %r" % (m,))
     if name is None:
         name = m.__name__
     tester = Tester(m, globs=globs, verbose=verbose, isprivate=isprivate,
@@ -1153,7 +1151,7 @@
         if testdict:
             if not hasattr(testdict, "items"):
                 raise TypeError("testmod: module.__test__ must support "
-                                ".items(); " + `testdict`)
+                                ".items(); %r" % (testdict,))
             f, t = tester.run__test__(testdict, name + ".__test__")
             failures += f
             tries += t
diff --git a/Lib/formatter.py b/Lib/formatter.py
index 3868b1b..109d66c 100644
--- a/Lib/formatter.py
+++ b/Lib/formatter.py
@@ -325,22 +325,22 @@
     """
 
     def new_alignment(self, align):
-        print "new_alignment(%s)" % `align`
+        print "new_alignment(%r)" % (align,)
 
     def new_font(self, font):
-        print "new_font(%s)" % `font`
+        print "new_font(%r)" % (font,)
 
     def new_margin(self, margin, level):
-        print "new_margin(%s, %d)" % (`margin`, level)
+        print "new_margin(%r, %d)" % (margin, level)
 
     def new_spacing(self, spacing):
-        print "new_spacing(%s)" % `spacing`
+        print "new_spacing(%r)" % (spacing,)
 
     def new_styles(self, styles):
-        print "new_styles(%s)" % `styles`
+        print "new_styles(%r)" % (styles,)
 
     def send_paragraph(self, blankline):
-        print "send_paragraph(%s)" % `blankline`
+        print "send_paragraph(%r)" % (blankline,)
 
     def send_line_break(self):
         print "send_line_break()"
@@ -349,13 +349,13 @@
         print "send_hor_rule()"
 
     def send_label_data(self, data):
-        print "send_label_data(%s)" % `data`
+        print "send_label_data(%r)" % (data,)
 
     def send_flowing_data(self, data):
-        print "send_flowing_data(%s)" % `data`
+        print "send_flowing_data(%r)" % (data,)
 
     def send_literal_data(self, data):
-        print "send_literal_data(%s)" % `data`
+        print "send_literal_data(%r)" % (data,)
 
 
 class DumbWriter(NullWriter):
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 @@
     """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 @@
     """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 @@
             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
diff --git a/Lib/ftplib.py b/Lib/ftplib.py
index d67a0aa..9486918 100644
--- a/Lib/ftplib.py
+++ b/Lib/ftplib.py
@@ -161,7 +161,7 @@
             while i > 5 and s[i-1] in '\r\n':
                 i = i-1
             s = s[:5] + '*'*(i-5) + s[i:]
-        return `s`
+        return repr(s)
 
     # Internal: send one line to the server, appending CRLF
     def putline(self, line):
@@ -250,7 +250,7 @@
         port number.
         '''
         hbytes = host.split('.')
-        pbytes = [`port/256`, `port%256`]
+        pbytes = [repr(port/256), repr(port%256)]
         bytes = hbytes + pbytes
         cmd = 'PORT ' + ','.join(bytes)
         return self.voidcmd(cmd)
@@ -264,7 +264,7 @@
             af = 2
         if af == 0:
             raise error_proto, 'unsupported address family'
-        fields = ['', `af`, host, `port`, '']
+        fields = ['', repr(af), host, repr(port), '']
         cmd = 'EPRT ' + '|'.join(fields)
         return self.voidcmd(cmd)
 
@@ -397,7 +397,7 @@
         fp = conn.makefile('rb')
         while 1:
             line = fp.readline()
-            if self.debugging > 2: print '*retr*', `line`
+            if self.debugging > 2: print '*retr*', repr(line)
             if not line:
                 break
             if line[-2:] == CRLF:
diff --git a/Lib/gopherlib.py b/Lib/gopherlib.py
index 03801d0..01eab0a 100644
--- a/Lib/gopherlib.py
+++ b/Lib/gopherlib.py
@@ -47,7 +47,7 @@
                 _type_to_name_map[eval(name)] = name[2:]
     if gtype in _type_to_name_map:
         return _type_to_name_map[gtype]
-    return 'TYPE=' + `gtype`
+    return 'TYPE=%r' % (gtype,)
 
 # Names for characters and strings
 CRLF = '\r\n'
@@ -113,7 +113,7 @@
         gtype = line[0]
         parts = line[1:].split(TAB)
         if len(parts) < 4:
-            print '(Bad line from server:', `line`, ')'
+            print '(Bad line from server: %r)' % (line,)
             continue
         if len(parts) > 4:
             if parts[4:] != ['+']:
@@ -198,7 +198,7 @@
         for item in entries: print item
     else:
         data = get_binary(f)
-        print 'binary data:', len(data), 'bytes:', `data[:100]`[:40]
+        print 'binary data:', len(data), 'bytes:', repr(data[:100])[:40]
 
 # Run the test when run as script
 if __name__ == '__main__':
diff --git a/Lib/gzip.py b/Lib/gzip.py
index a5d4087..d51b7db 100644
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -442,7 +442,7 @@
                 g = sys.stdout
             else:
                 if arg[-3:] != ".gz":
-                    print "filename doesn't end in .gz:", `arg`
+                    print "filename doesn't end in .gz:", repr(arg)
                     continue
                 f = open(arg, "rb")
                 g = __builtin__.open(arg[:-3], "wb")
diff --git a/Lib/idlelib/ColorDelegator.py b/Lib/idlelib/ColorDelegator.py
index d72d90c..7b7be22 100644
--- a/Lib/idlelib/ColorDelegator.py
+++ b/Lib/idlelib/ColorDelegator.py
@@ -182,7 +182,7 @@
                 lines_to_get = min(lines_to_get * 2, 100)
                 ok = "SYNC" in self.tag_names(next + "-1c")
                 line = self.get(mark, next)
-                ##print head, "get", mark, next, "->", `line`
+                ##print head, "get", mark, next, "->", repr(line)
                 if not line:
                     return
                 for tag in self.tagdefs.keys():
diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py
index 0f0961c..65ffe54 100644
--- a/Lib/idlelib/EditorWindow.py
+++ b/Lib/idlelib/EditorWindow.py
@@ -761,7 +761,7 @@
             try:
                 self.load_extension(name)
             except:
-                print "Failed to load extension", `name`
+                print "Failed to load extension", repr(name)
                 import traceback
                 traceback.print_exc()
 
@@ -937,7 +937,7 @@
             elif key == 'context_use_ps1':
                 self.context_use_ps1 = value
             else:
-                raise KeyError, "bad option name: %s" % `key`
+                raise KeyError, "bad option name: %r" % (key,)
 
     # If ispythonsource and guess are true, guess a good value for
     # indentwidth based on file content (if possible), and if
@@ -1071,7 +1071,7 @@
             y = PyParse.Parser(self.indentwidth, self.tabwidth)
             for context in self.num_context_lines:
                 startat = max(lno - context, 1)
-                startatindex = `startat` + ".0"
+                startatindex = repr(startat) + ".0"
                 rawtext = text.get(startatindex, "insert")
                 y.set_str(rawtext)
                 bod = y.find_good_parse_start(
@@ -1103,7 +1103,7 @@
                     else:
                         self.reindent_to(y.compute_backslash_indent())
                 else:
-                    assert 0, "bogus continuation type " + `c`
+                    assert 0, "bogus continuation type %r" % (c,)
                 return "break"
 
             # This line starts a brand new stmt; indent relative to
@@ -1333,7 +1333,7 @@
         if self.finished:
             return ""
         i = self.i = self.i + 1
-        mark = `i` + ".0"
+        mark = repr(i) + ".0"
         if self.text.compare(mark, ">=", "end"):
             return ""
         return self.text.get(mark, mark + " lineend+1c")
diff --git a/Lib/idlelib/FileList.py b/Lib/idlelib/FileList.py
index 4e08e70..198055a 100644
--- a/Lib/idlelib/FileList.py
+++ b/Lib/idlelib/FileList.py
@@ -35,7 +35,7 @@
         if os.path.isdir(filename):
             tkMessageBox.showerror(
                 "Is A Directory",
-                "The path %s is a directory." % `filename`,
+                "The path %r is a directory." % (filename,),
                 master=self.root)
             return None
         key = os.path.normcase(filename)
@@ -46,7 +46,7 @@
         if not os.path.exists(filename):
             tkMessageBox.showinfo(
                 "New File",
-                "Opening non-existent file %s" % `filename`,
+                "Opening non-existent file %r" % (filename,),
                 master=self.root)
         if action is None:
             return self.EditorWindow(self, filename, key)
@@ -102,7 +102,7 @@
             self.inversedict[conflict] = None
             tkMessageBox.showerror(
                 "Name Conflict",
-                "You now have multiple edit windows open for %s" % `filename`,
+                "You now have multiple edit windows open for %r" % (filename,),
                 master=self.root)
         self.dict[newkey] = edit
         self.inversedict[edit] = newkey
diff --git a/Lib/idlelib/GrepDialog.py b/Lib/idlelib/GrepDialog.py
index 79fad31..ab136bc 100644
--- a/Lib/idlelib/GrepDialog.py
+++ b/Lib/idlelib/GrepDialog.py
@@ -77,7 +77,7 @@
         list.sort()
         self.close()
         pat = self.engine.getpat()
-        print "Searching %s in %s ..." % (`pat`, path)
+        print "Searching %r in %s ..." % (pat, path)
         hits = 0
         for fn in list:
             try:
diff --git a/Lib/idlelib/ObjectBrowser.py b/Lib/idlelib/ObjectBrowser.py
index 416be5a..a2a6cee 100644
--- a/Lib/idlelib/ObjectBrowser.py
+++ b/Lib/idlelib/ObjectBrowser.py
@@ -97,7 +97,7 @@
                 continue
             def setfunction(value, key=key, object=self.object):
                 object[key] = value
-            item = make_objecttreeitem(`key` + ":", value, setfunction)
+            item = make_objecttreeitem("%r:" % (key,), value, setfunction)
             sublist.append(item)
         return sublist
 
diff --git a/Lib/idlelib/ParenMatch.py b/Lib/idlelib/ParenMatch.py
index bd4e077..407f468 100644
--- a/Lib/idlelib/ParenMatch.py
+++ b/Lib/idlelib/ParenMatch.py
@@ -142,7 +142,7 @@
         y = PyParse.Parser(self.indentwidth, self.tabwidth)
         for context in self.num_context_lines:
             startat = max(lno - context, 1)
-            startatindex = `startat` + ".0"
+            startatindex = repr(startat) + ".0"
             # rawtext needs to contain everything up to the last
             # character, which was the close paren.  the parser also
             # requires that the last line ends with "\n"
diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py
index 0605285..c619b7f 100644
--- a/Lib/idlelib/PyShell.py
+++ b/Lib/idlelib/PyShell.py
@@ -335,9 +335,9 @@
         del_exitf = idleConf.GetOption('main', 'General', 'delete-exitfunc',
                                        default=False, type='bool')
         if __name__ == 'idlelib.PyShell':
-            command = "__import__('idlelib.run').run.main(" + `del_exitf` +")"
+            command = "__import__('idlelib.run').run.main(%r)" % (del_exitf,)
         else:
-            command = "__import__('run').main(" + `del_exitf` + ")"
+            command = "__import__('run').main(%r)" % (del_exitf,)
         if sys.platform[:3] == 'win' and ' ' in sys.executable:
             # handle embedded space in path by quoting the argument
             decorated_exec = '"%s"' % sys.executable
@@ -454,12 +454,12 @@
     def transfer_path(self):
         self.runcommand("""if 1:
         import sys as _sys
-        _sys.path = %s
+        _sys.path = %r
         del _sys
         _msg = 'Use File/Exit or your end-of-file key to quit IDLE'
         __builtins__.quit = __builtins__.exit = _msg
         del _msg
-        \n""" % `sys.path`)
+        \n""" % (sys.path,))
 
     active_seq = None
 
@@ -483,7 +483,7 @@
             console = self.tkconsole.console
             if how == "OK":
                 if what is not None:
-                    print >>console, `what`
+                    print >>console, repr(what)
             elif how == "EXCEPTION":
                 if self.tkconsole.getvar("<<toggle-jit-stack-viewer>>"):
                     self.remote_stack_viewer()
@@ -589,14 +589,14 @@
     def prepend_syspath(self, filename):
         "Prepend sys.path with file's directory if not already included"
         self.runcommand("""if 1:
-            _filename = %s
+            _filename = %r
             import sys as _sys
             from os.path import dirname as _dirname
             _dir = _dirname(_filename)
             if not _dir in _sys.path:
                 _sys.path.insert(0, _dir)
             del _filename, _sys, _dirname, _dir
-            \n""" % `filename`)
+            \n""" % (filename,))
 
     def showsyntaxerror(self, filename=None):
         """Extend base class method: Add Colorizing
@@ -1333,9 +1333,9 @@
     if shell and cmd or script:
         shell.interp.runcommand("""if 1:
             import sys as _sys
-            _sys.argv = %s
+            _sys.argv = %r
             del _sys
-            \n""" % `sys.argv`)
+            \n""" % (sys.argv,))
         if cmd:
             shell.interp.execsource(cmd)
         elif script:
diff --git a/Lib/idlelib/RemoteDebugger.py b/Lib/idlelib/RemoteDebugger.py
index bdcef51..74085c3 100644
--- a/Lib/idlelib/RemoteDebugger.py
+++ b/Lib/idlelib/RemoteDebugger.py
@@ -94,7 +94,7 @@
         self.idb.set_return(frame)
 
     def get_stack(self, fid, tbid):
-        ##print >>sys.__stderr__, "get_stack(%s, %s)" % (`fid`, `tbid`)
+        ##print >>sys.__stderr__, "get_stack(%r, %r)" % (fid, tbid)
         frame = frametable[fid]
         if tbid is None:
             tb = None
@@ -295,7 +295,7 @@
     def call(self, methodname, *args, **kwargs):
         ##print "**IdbProxy.call %s %s %s" % (methodname, args, kwargs)
         value = self.conn.remotecall(self.oid, methodname, args, kwargs)
-        ##print "**IdbProxy.call %s returns %s" % (methodname, `value`)
+        ##print "**IdbProxy.call %s returns %r" % (methodname, value)
         return value
 
     def run(self, cmd, locals):
diff --git a/Lib/idlelib/ScriptBinding.py b/Lib/idlelib/ScriptBinding.py
index c0fa88f..a1d937b 100644
--- a/Lib/idlelib/ScriptBinding.py
+++ b/Lib/idlelib/ScriptBinding.py
@@ -145,16 +145,16 @@
         dirname = os.path.dirname(filename)
         # XXX Too often this discards arguments the user just set...
         interp.runcommand("""if 1:
-            _filename = %s
+            _filename = %r
             import sys as _sys
             from os.path import basename as _basename
             if (not _sys.argv or
                 _basename(_sys.argv[0]) != _basename(_filename)):
                 _sys.argv = [_filename]
             import os as _os
-            _os.chdir(%s)
+            _os.chdir(%r)
             del _filename, _sys, _basename, _os
-            \n""" % (`filename`, `dirname`))
+            \n""" % (filename, dirname))
         interp.prepend_syspath(filename)
         interp.runcode(code)
 
diff --git a/Lib/idlelib/TreeWidget.py b/Lib/idlelib/TreeWidget.py
index 824bdca..1c9eb2e 100644
--- a/Lib/idlelib/TreeWidget.py
+++ b/Lib/idlelib/TreeWidget.py
@@ -31,7 +31,7 @@
 if os.path.isdir(_icondir):
     ICONDIR = _icondir
 elif not os.path.isdir(ICONDIR):
-    raise RuntimeError, "can't find icon directory (%s)" % `ICONDIR`
+    raise RuntimeError, "can't find icon directory (%r)" % (ICONDIR,)
 
 def listicons(icondir=ICONDIR):
     """Utility to display the available icons."""
diff --git a/Lib/idlelib/UndoDelegator.py b/Lib/idlelib/UndoDelegator.py
index 2452a98..182a117 100644
--- a/Lib/idlelib/UndoDelegator.py
+++ b/Lib/idlelib/UndoDelegator.py
@@ -177,7 +177,7 @@
         t = (self.index1, self.index2, self.chars, self.tags)
         if self.tags is None:
             t = t[:-1]
-        return s + `t`
+        return s + repr(t)
 
     def do(self, text):
         pass
@@ -310,7 +310,7 @@
         s = self.__class__.__name__
         strs = []
         for cmd in self.cmds:
-            strs.append("    " + `cmd`)
+            strs.append("    %r" % (cmd,))
         return s + "(\n" + ",\n".join(strs) + "\n)"
 
     def __len__(self):
diff --git a/Lib/idlelib/WidgetRedirector.py b/Lib/idlelib/WidgetRedirector.py
index be74668..df60cea 100644
--- a/Lib/idlelib/WidgetRedirector.py
+++ b/Lib/idlelib/WidgetRedirector.py
@@ -69,7 +69,7 @@
         self.orig_and_name = (self.orig, self.name)
 
     def __repr__(self):
-        return "OriginalCommand(%s, %s)" % (`self.redir`, `self.name`)
+        return "OriginalCommand(%r, %r)" % (self.redir, self.name)
 
     def __call__(self, *args):
         return self.tk_call(self.orig_and_name + args)
diff --git a/Lib/idlelib/aboutDialog.py b/Lib/idlelib/aboutDialog.py
index 3d2bcf6..c121061 100644
--- a/Lib/idlelib/aboutDialog.py
+++ b/Lib/idlelib/aboutDialog.py
@@ -66,7 +66,7 @@
                                sys.version.split()[0], fg=self.fg, bg=self.bg)
         labelPythonVer.grid(row=9, column=0, sticky=W, padx=10, pady=0)
         # handle weird tk version num in windoze python >= 1.6 (?!?)
-        tkVer = `TkVersion`.split('.')
+        tkVer = repr(TkVersion).split('.')
         tkVer[len(tkVer)-1] = str('%.3g' % (float('.'+tkVer[len(tkVer)-1])))[2:]
         if tkVer[len(tkVer)-1] == '':
             tkVer[len(tkVer)-1] = '0'
@@ -141,8 +141,7 @@
             except IOError:
                 import tkMessageBox
                 tkMessageBox.showerror(title='File Load Error',
-                                       message='Unable to load file '+
-                                       `fn`+' .',
+                                       message='Unable to load file %r .' % (fn,),
                                        parent=self)
                 return
             else:
diff --git a/Lib/idlelib/configDialog.py b/Lib/idlelib/configDialog.py
index 8c3eb3e..4e4e564 100644
--- a/Lib/idlelib/configDialog.py
+++ b/Lib/idlelib/configDialog.py
@@ -718,7 +718,7 @@
     def DeleteCustomKeys(self):
         keySetName=self.customKeys.get()
         if not tkMessageBox.askyesno('Delete Key Set','Are you sure you wish '+
-                                     'to delete the key set '+`keySetName`+' ?',
+                                     'to delete the key set %r ?' % (keySetName),
                                      parent=self):
             return
         #remove key set from config
@@ -745,7 +745,7 @@
     def DeleteCustomTheme(self):
         themeName=self.customTheme.get()
         if not tkMessageBox.askyesno('Delete Theme','Are you sure you wish '+
-                                     'to delete the theme '+`themeName`+' ?',
+                                     'to delete the theme %r ?' % (themeName,),
                                      parent=self):
             return
         #remove theme from config
diff --git a/Lib/idlelib/configHandler.py b/Lib/idlelib/configHandler.py
index 3d79fb9..d1c2b3c 100644
--- a/Lib/idlelib/configHandler.py
+++ b/Lib/idlelib/configHandler.py
@@ -231,10 +231,11 @@
         elif self.defaultCfg[configType].has_option(section,option):
             return self.defaultCfg[configType].Get(section, option, type=type)
         else: #returning default, print warning
-            warning=('\n Warning: configHandler.py - IdleConf.GetOption -\n'+
-                       ' problem retrieving configration option '+`option`+'\n'+
-                       ' from section '+`section`+'.\n'+
-                       ' returning default value: '+`default`+'\n')
+            warning=('\n Warning: configHandler.py - IdleConf.GetOption -\n'
+                       ' problem retrieving configration option %r\n'
+                       ' from section %r.\n'
+                       ' returning default value: %r\n' % 
+                       (option, section, default))
             sys.stderr.write(warning)
             return default
 
@@ -331,10 +332,11 @@
         for element in theme.keys():
             if not cfgParser.has_option(themeName,element):
                 #we are going to return a default, print warning
-                warning=('\n Warning: configHandler.py - IdleConf.GetThemeDict'+
-                           ' -\n problem retrieving theme element '+`element`+
-                           '\n from theme '+`themeName`+'.\n'+
-                           ' returning default value: '+`theme[element]`+'\n')
+                warning=('\n Warning: configHandler.py - IdleConf.GetThemeDict'
+                           ' -\n problem retrieving theme element %r'
+                           '\n from theme %r.\n'
+                           ' returning default value: %r\n' %
+                           (element, themeName, theme[element]))
                 sys.stderr.write(warning)
             colour=cfgParser.Get(themeName,element,default=theme[element])
             theme[element]=colour
@@ -561,10 +563,11 @@
                 if binding:
                     keyBindings[event]=binding
                 else: #we are going to return a default, print warning
-                    warning=('\n Warning: configHandler.py - IdleConf.GetCoreKeys'+
-                               ' -\n problem retrieving key binding for event '+
-                               `event`+'\n from key set '+`keySetName`+'.\n'+
-                               ' returning default value: '+`keyBindings[event]`+'\n')
+                    warning=('\n Warning: configHandler.py - IdleConf.GetCoreKeys'
+                               ' -\n problem retrieving key binding for event %r'
+                               '\n from key set %r.\n'
+                               ' returning default value: %r\n' %
+                               (event, keySetName, keyBindings[event]))
                     sys.stderr.write(warning)
         return keyBindings
 
diff --git a/Lib/idlelib/rpc.py b/Lib/idlelib/rpc.py
index d3a9fd8..d097f9b 100644
--- a/Lib/idlelib/rpc.py
+++ b/Lib/idlelib/rpc.py
@@ -58,7 +58,7 @@
 
 #  def pickle_function(fn):
 #      assert isinstance(fn, type.FunctionType)
-#      return `fn`
+#      return repr(fn)
 
 copy_reg.pickle(types.CodeType, pickle_code, unpickle_code)
 # copy_reg.pickle(types.FunctionType, pickle_function, unpickle_function)
@@ -170,7 +170,7 @@
         except TypeError:
             return ("ERROR", "Bad request format")
         if not self.objtable.has_key(oid):
-            return ("ERROR", "Unknown object id: %s" % `oid`)
+            return ("ERROR", "Unknown object id: %r" % (oid,))
         obj = self.objtable[oid]
         if methodname == "__methods__":
             methods = {}
@@ -181,7 +181,7 @@
             _getattributes(obj, attributes)
             return ("OK", attributes)
         if not hasattr(obj, methodname):
-            return ("ERROR", "Unsupported method name: %s" % `methodname`)
+            return ("ERROR", "Unsupported method name: %r" % (methodname,))
         method = getattr(obj, methodname)
         try:
             if how == 'CALL':
@@ -321,7 +321,7 @@
         try:
             s = pickle.dumps(message)
         except pickle.PicklingError:
-            print >>sys.__stderr__, "Cannot pickle:", `message`
+            print >>sys.__stderr__, "Cannot pickle:", repr(message)
             raise
         s = struct.pack("<i", len(s)) + s
         while len(s) > 0:
@@ -377,7 +377,7 @@
             message = pickle.loads(packet)
         except pickle.UnpicklingError:
             print >>sys.__stderr__, "-----------------------"
-            print >>sys.__stderr__, "cannot unpickle packet:", `packet`
+            print >>sys.__stderr__, "cannot unpickle packet:", repr(packet)
             traceback.print_stack(file=sys.__stderr__)
             print >>sys.__stderr__, "-----------------------"
             raise
diff --git a/Lib/idlelib/textView.py b/Lib/idlelib/textView.py
index be3ade0..917a6cc 100644
--- a/Lib/idlelib/textView.py
+++ b/Lib/idlelib/textView.py
@@ -46,7 +46,7 @@
             textFile = open(fileName, 'r')
         except IOError:
             tkMessageBox.showerror(title='File Load Error',
-                    message='Unable to load file '+`fileName`+' .')
+                    message='Unable to load file %r .' % (fileName,))
         else:
             self.textView.insert(0.0,textFile.read())
 
diff --git a/Lib/ihooks.py b/Lib/ihooks.py
index 19faac9..936a950 100644
--- a/Lib/ihooks.py
+++ b/Lib/ihooks.py
@@ -273,8 +273,8 @@
             elif type == PKG_DIRECTORY:
                 m = self.hooks.load_package(name, filename, file)
             else:
-                raise ImportError, "Unrecognized module type (%s) for %s" % \
-                      (`type`, name)
+                raise ImportError, "Unrecognized module type (%r) for %s" % \
+                      (type, name)
         finally:
             if file: file.close()
         m.__file__ = filename
@@ -299,8 +299,8 @@
             if inittype not in (PY_COMPILED, PY_SOURCE):
                 if initfile: initfile.close()
                 raise ImportError, \
-                    "Bad type (%s) for __init__ module in package %s" % (
-                    `inittype`, name)
+                    "Bad type (%r) for __init__ module in package %s" % (
+                    inittype, name)
             path = [filename]
             file = initfile
             realfilename = initfilename
diff --git a/Lib/imaplib.py b/Lib/imaplib.py
index 8004982..0112ddc 100644
--- a/Lib/imaplib.py
+++ b/Lib/imaplib.py
@@ -192,7 +192,7 @@
 
         if __debug__:
             if self.debug >= 3:
-                self._mesg('CAPABILITIES: %s' % `self.capabilities`)
+                self._mesg('CAPABILITIES: %r' % (self.capabilities,))
 
         for version in AllowedVersions:
             if not version in self.capabilities:
@@ -972,7 +972,7 @@
         self.mo = cre.match(s)
         if __debug__:
             if self.mo is not None and self.debug >= 5:
-                self._mesg("\tmatched r'%s' => %s" % (cre.pattern, `self.mo.groups()`))
+                self._mesg("\tmatched r'%s' => %r" % (cre.pattern, self.mo.groups()))
         return self.mo is not None
 
 
@@ -1416,7 +1416,7 @@
         if M.state == 'AUTH':
             test_seq1 = test_seq1[1:]   # Login not needed
         M._mesg('PROTOCOL_VERSION = %s' % M.PROTOCOL_VERSION)
-        M._mesg('CAPABILITIES = %s' % `M.capabilities`)
+        M._mesg('CAPABILITIES = %r' % (M.capabilities,))
 
         for cmd,args in test_seq1:
             run(cmd, args)
diff --git a/Lib/lib-tk/FileDialog.py b/Lib/lib-tk/FileDialog.py
index 323dc29..5e848da 100644
--- a/Lib/lib-tk/FileDialog.py
+++ b/Lib/lib-tk/FileDialog.py
@@ -244,7 +244,7 @@
                 return
             d = Dialog(self.top,
                        title="Overwrite Existing File Question",
-                       text="Overwrite existing file %s?" % `file`,
+                       text="Overwrite existing file %r?" % (file,),
                        bitmap='questhead',
                        default=1,
                        strings=("Yes", "Cancel"))
diff --git a/Lib/lib-tk/Tix.py b/Lib/lib-tk/Tix.py
index 99731cd..9114538 100755
--- a/Lib/lib-tk/Tix.py
+++ b/Lib/lib-tk/Tix.py
@@ -374,9 +374,9 @@
         if option == '':
             return
         elif not isinstance(option, StringType):
-            option = `option`
+            option = repr(option)
         if not isinstance(value, StringType):
-            value = `value`
+            value = repr(value)
         names = self._subwidget_names()
         for name in names:
             self.tk.call(name, 'configure', '-' + option, value)
diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py
index b5b0af3..67e942e 100644
--- a/Lib/lib-tk/Tkinter.py
+++ b/Lib/lib-tk/Tkinter.py
@@ -177,7 +177,7 @@
             master = _default_root
         self._master = master
         self._tk = master.tk
-        self._name = 'PY_VAR' + `_varnum`
+        self._name = 'PY_VAR' + repr(_varnum)
         _varnum = _varnum + 1
         self.set(self._default)
     def __del__(self):
@@ -1022,7 +1022,7 @@
         be executed. An optional function SUBST can
         be given which will be executed before FUNC."""
         f = CallWrapper(func, subst, self).__call__
-        name = `id(f)`
+        name = repr(id(f))
         try:
             func = func.im_func
         except AttributeError:
@@ -1810,7 +1810,7 @@
             name = cnf['name']
             del cnf['name']
         if not name:
-            name = `id(self)`
+            name = repr(id(self))
         self._name = name
         if master._w=='.':
             self._w = '.' + name
@@ -1957,9 +1957,9 @@
     return 'sel.last'
 def At(x, y=None):
     if y is None:
-        return '@' + `x`
+        return '@%r' % (x,)
     else:
-        return '@' + `x` + ',' + `y`
+        return '@%r,%r' % (x, y)
 
 class Canvas(Widget):
     """Canvas widget to display graphical elements like lines or text."""
@@ -3118,7 +3118,7 @@
         self.tk = master.tk
         if not name:
             Image._last_id += 1
-            name = "pyimage" +`Image._last_id` # tk itself would use image<x>
+            name = "pyimage%r" % (Image._last_id,) # tk itself would use image<x>
             # The following is needed for systems where id(x)
             # can return a negative number, such as Linux/m68k:
             if name[0] == '-': name = '_' + name[1:]
diff --git a/Lib/lib-tk/turtle.py b/Lib/lib-tk/turtle.py
index b56d91c..a395613 100644
--- a/Lib/lib-tk/turtle.py
+++ b/Lib/lib-tk/turtle.py
@@ -95,18 +95,18 @@
                 try:
                     id = self._canvas.create_line(0, 0, 0, 0, fill=color)
                 except Tkinter.TclError:
-                    raise Error, "bad color string: %s" % `color`
+                    raise Error, "bad color string: %r" % (color,)
                 self._set_color(color)
                 return
             try:
                 r, g, b = color
             except:
-                raise Error, "bad color sequence: %s" % `color`
+                raise Error, "bad color sequence: %r" % (color,)
         else:
             try:
                 r, g, b = args
             except:
-                raise Error, "bad color arguments: %s" % `args`
+                raise Error, "bad color arguments: %r" % (args,)
         assert 0 <= r <= 1
         assert 0 <= g <= 1
         assert 0 <= b <= 1
@@ -240,12 +240,12 @@
             try:
                 x, y = args[0]
             except:
-                raise Error, "bad point argument: %s" % `args[0]`
+                raise Error, "bad point argument: %r" % (args[0],)
         else:
             try:
                 x, y = args
             except:
-                raise Error, "bad coordinates: %s" % `args[0]`
+                raise Error, "bad coordinates: %r" % (args[0],)
         x0, y0 = self._origin
         self._goto(x0+x, y0-y)
 
diff --git a/Lib/macurl2path.py b/Lib/macurl2path.py
index 3c1acc0..ed23883 100644
--- a/Lib/macurl2path.py
+++ b/Lib/macurl2path.py
@@ -80,7 +80,7 @@
                 "/foo/bar/index.html",
                 "/foo/bar/",
                 "/"]:
-        print `url`, '->', `url2pathname(url)`
+        print '%r -> %r' % (url, url2pathname(url))
     for path in ["drive:",
                  "drive:dir:",
                  "drive:dir:file",
@@ -89,7 +89,7 @@
                  ":file",
                  ":dir:",
                  ":dir:file"]:
-        print `path`, '->', `pathname2url(path)`
+        print '%r -> %r' % (path, pathname2url(path))
 
 if __name__ == '__main__':
     test()
diff --git a/Lib/markupbase.py b/Lib/markupbase.py
index 62587e0..c1e5acd 100644
--- a/Lib/markupbase.py
+++ b/Lib/markupbase.py
@@ -124,7 +124,7 @@
                     self.error("unexpected '[' char in declaration")
             else:
                 self.error(
-                    "unexpected %s char in declaration" % `rawdata[j]`)
+                    "unexpected %r char in declaration" % rawdata[j])
             if j < 0:
                 return j
         return -1 # incomplete
@@ -144,7 +144,7 @@
             # look for MS Office ]> ending
             match= _msmarkedsectionclose.search(rawdata, i+3)
         else:
-            self.error('unknown status keyword %s in marked section' % `rawdata[i+3:j]`)
+            self.error('unknown status keyword %r in marked section' % rawdata[i+3:j])
         if not match:
             return -1
         if report:
@@ -180,8 +180,7 @@
                     return -1
                 if s != "<!":
                     self.updatepos(declstartpos, j + 1)
-                    self.error("unexpected char in internal subset (in %s)"
-                               % `s`)
+                    self.error("unexpected char in internal subset (in %r)" % s)
                 if (j + 2) == n:
                     # end of buffer; incomplete
                     return -1
@@ -199,7 +198,7 @@
                 if name not in ("attlist", "element", "entity", "notation"):
                     self.updatepos(declstartpos, j + 2)
                     self.error(
-                        "unknown declaration %s in internal subset" % `name`)
+                        "unknown declaration %r in internal subset" % name)
                 # handle the individual names
                 meth = getattr(self, "_parse_doctype_" + name)
                 j = meth(j, declstartpos)
@@ -230,7 +229,7 @@
                 j = j + 1
             else:
                 self.updatepos(declstartpos, j)
-                self.error("unexpected char %s in internal subset" % `c`)
+                self.error("unexpected char %r in internal subset" % c)
         # end of buffer reached
         return -1
 
diff --git a/Lib/mhlib.py b/Lib/mhlib.py
index 899939a..0a8c444 100644
--- a/Lib/mhlib.py
+++ b/Lib/mhlib.py
@@ -109,7 +109,7 @@
 
     def __repr__(self):
         """String representation."""
-        return 'MH(%s, %s)' % (`self.path`, `self.profile`)
+        return 'MH(%r, %r)' % (self.path, self.profile)
 
     def error(self, msg, *args):
         """Routine to print an error.  May be overridden by a derived class."""
@@ -247,7 +247,7 @@
 
     def __repr__(self):
         """String representation."""
-        return 'Folder(%s, %s)' % (`self.mh`, `self.name`)
+        return 'Folder(%r, %r)' % (self.mh, self.name)
 
     def error(self, *args):
         """Error message handler."""
@@ -716,7 +716,7 @@
         mf.push(bdry)
         parts = []
         while mf.next():
-            n = str(self.number) + '.' + `1 + len(parts)`
+            n = "%s.%r" % (self.number, 1 + len(parts))
             part = SubMessage(self.folder, n, mf)
             parts.append(part)
         mf.pop()
@@ -800,8 +800,7 @@
         return hash(self.pairs)
 
     def __repr__(self):
-        return 'IntSet(%s, %s, %s)' % (`self.tostring()`,
-                  `self.sep`, `self.rng`)
+        return 'IntSet(%r, %r, %r)' % (self.tostring(), self.sep, self.rng)
 
     def normalize(self):
         self.pairs.sort()
@@ -817,8 +816,8 @@
     def tostring(self):
         s = ''
         for lo, hi in self.pairs:
-            if lo == hi: t = `lo`
-            else: t = `lo` + self.rng + `hi`
+            if lo == hi: t = repr(lo)
+            else: t = repr(lo) + self.rng + repr(hi)
             if s: s = s + (self.sep + t)
             else: s = t
         return s
@@ -963,7 +962,7 @@
     testfolders = ['@test', '@test/test1', '@test/test2',
                    '@test/test1/test11', '@test/test1/test12',
                    '@test/test1/test11/test111']
-    for t in testfolders: do('mh.makefolder(%s)' % `t`)
+    for t in testfolders: do('mh.makefolder(%r)' % (t,))
     do('mh.listsubfolders(\'@test\')')
     do('mh.listallsubfolders(\'@test\')')
     f = mh.openfolder('@test')
@@ -975,7 +974,7 @@
     print seqs
     f.putsequences(seqs)
     do('f.getsequences()')
-    for t in reversed(testfolders): do('mh.deletefolder(%s)' % `t`)
+    for t in reversed(testfolders): do('mh.deletefolder(%r)' % (t,))
     do('mh.getcontext()')
     context = mh.getcontext()
     f = mh.openfolder(context)
@@ -986,10 +985,10 @@
                 '1:3', '1:-3', '100:3', '100:-3', '10000:3', '10000:-3',
                 'all']:
         try:
-            do('f.parsesequence(%s)' % `seq`)
+            do('f.parsesequence(%r)' % (seq,))
         except Error, msg:
             print "Error:", msg
-        stuff = os.popen("pick %s 2>/dev/null" % `seq`).read()
+        stuff = os.popen("pick %r 2>/dev/null" % (seq,)).read()
         list = map(int, stuff.split())
         print list, "<-- pick"
     do('f.listmessages()')
diff --git a/Lib/mimetools.py b/Lib/mimetools.py
index 067a2cd..0b698ac 100644
--- a/Lib/mimetools.py
+++ b/Lib/mimetools.py
@@ -129,11 +129,11 @@
         import socket
         hostid = socket.gethostbyname(socket.gethostname())
         try:
-            uid = `os.getuid()`
+            uid = repr(os.getuid())
         except AttributeError:
             uid = '1'
         try:
-            pid = `os.getpid()`
+            pid = repr(os.getpid())
         except AttributeError:
             pid = '1'
         _prefix = hostid + '.' + uid + '.' + pid
diff --git a/Lib/modulefinder.py b/Lib/modulefinder.py
index 6dec0e5..07b260d 100644
--- a/Lib/modulefinder.py
+++ b/Lib/modulefinder.py
@@ -62,11 +62,11 @@
         self.starimports = {}
 
     def __repr__(self):
-        s = "Module(%s" % `self.__name__`
+        s = "Module(%r" % % (self.__name__,)
         if self.__file__ is not None:
-            s = s + ", %s" % `self.__file__`
+            s = s + ", %r" % (self.__file__,)
         if self.__path__ is not None:
-            s = s + ", %s" % `self.__path__`
+            s = s + ", %r" % (self.__path__,)
         s = s + ")"
         return s
 
@@ -564,7 +564,7 @@
     if debug > 1:
         print "path:"
         for item in path:
-            print "   ", `item`
+            print "   ", repr(item)
 
     # Create the module finder and turn its crank
     mf = ModuleFinder(path, debug, exclude)
diff --git a/Lib/nntplib.py b/Lib/nntplib.py
index 6299ba2..83544b8 100644
--- a/Lib/nntplib.py
+++ b/Lib/nntplib.py
@@ -175,7 +175,7 @@
         If the response code is 200, posting is allowed;
         if it 201, posting is not allowed."""
 
-        if self.debugging: print '*welcome*', `self.welcome`
+        if self.debugging: print '*welcome*', repr(self.welcome)
         return self.welcome
 
     def set_debuglevel(self, level):
@@ -190,12 +190,12 @@
     def putline(self, line):
         """Internal: send one line to the server, appending CRLF."""
         line = line + CRLF
-        if self.debugging > 1: print '*put*', `line`
+        if self.debugging > 1: print '*put*', repr(line)
         self.sock.sendall(line)
 
     def putcmd(self, line):
         """Internal: send one command to the server (through putline())."""
-        if self.debugging: print '*cmd*', `line`
+        if self.debugging: print '*cmd*', repr(line)
         self.putline(line)
 
     def getline(self):
@@ -203,7 +203,7 @@
         Raise EOFError if the connection is closed."""
         line = self.file.readline()
         if self.debugging > 1:
-            print '*get*', `line`
+            print '*get*', repr(line)
         if not line: raise EOFError
         if line[-2:] == CRLF: line = line[:-2]
         elif line[-1:] in CRLF: line = line[:-1]
@@ -213,7 +213,7 @@
         """Internal: get a response from the server.
         Raise various errors if the response indicates an error."""
         resp = self.getline()
-        if self.debugging: print '*resp*', `resp`
+        if self.debugging: print '*resp*', repr(resp)
         c = resp[:1]
         if c == '4':
             raise NNTPTemporaryError(resp)
diff --git a/Lib/opcode.py b/Lib/opcode.py
index cfde5f8..39d4bd2 100644
--- a/Lib/opcode.py
+++ b/Lib/opcode.py
@@ -21,7 +21,7 @@
 
 opmap = {}
 opname = [''] * 256
-for op in range(256): opname[op] = '<' + `op` + '>'
+for op in range(256): opname[op] = '<%r>' % (op,)
 del op
 
 def def_op(name, op):
diff --git a/Lib/pdb.py b/Lib/pdb.py
index 9a08a6a..b35164c 100755
--- a/Lib/pdb.py
+++ b/Lib/pdb.py
@@ -219,7 +219,7 @@
             filename = arg[:colon].rstrip()
             f = self.lookupmodule(filename)
             if not f:
-                print '*** ', `filename`,
+                print '*** ', repr(filename),
                 print 'not found from sys.path'
                 return
             else:
@@ -252,7 +252,7 @@
                     (ok, filename, ln) = self.lineinfo(arg)
                     if not ok:
                         print '*** The specified object',
-                        print `arg`,
+                        print repr(arg),
                         print 'is not a function'
                         print ('or was not found '
                                'along sys.path.')
@@ -596,7 +596,7 @@
             if isinstance(t, str):
                 exc_type_name = t
             else: exc_type_name = t.__name__
-            print '***', exc_type_name + ':', `v`
+            print '***', exc_type_name + ':', repr(v)
             raise
 
     def do_p(self, arg):
@@ -627,7 +627,7 @@
                 else:
                     first = max(1, int(x) - 5)
             except:
-                print '*** Error in argument:', `arg`
+                print '*** Error in argument:', repr(arg)
                 return
         elif self.lineno is None:
             first = max(1, self.curframe.f_lineno - 5)
@@ -644,7 +644,7 @@
                     print '[EOF]'
                     break
                 else:
-                    s = `lineno`.rjust(3)
+                    s = repr(lineno).rjust(3)
                     if len(s) < 4: s = s + ' '
                     if lineno in breaklist: s = s + 'B'
                     else: s = s + ' '
@@ -665,7 +665,7 @@
             if type(t) == type(''):
                 exc_type_name = t
             else: exc_type_name = t.__name__
-            print '***', exc_type_name + ':', `v`
+            print '***', exc_type_name + ':', repr(v)
             return
         code = None
         # Is it a function?
@@ -1034,7 +1034,7 @@
 
     mainpyfile = filename = sys.argv[1]     # Get script filename
     if not os.path.exists(filename):
-        print 'Error:', `filename`, 'does not exist'
+        print 'Error:', repr(filename), 'does not exist'
         sys.exit(1)
     mainmodule = os.path.basename(filename)
     del sys.argv[0]         # Hide "pdb.py" from argument list
@@ -1042,4 +1042,4 @@
     # Insert script directory in front of module search path
     sys.path.insert(0, os.path.dirname(filename))
 
-    run('execfile(' + `filename` + ')')
+    run('execfile(%r)' % (filename,))
diff --git a/Lib/pickle.py b/Lib/pickle.py
index a854948..69fc2cc 100644
--- a/Lib/pickle.py
+++ b/Lib/pickle.py
@@ -261,7 +261,7 @@
             else:
                 return LONG_BINPUT + pack("<i", i)
 
-        return PUT + `i` + '\n'
+        return PUT + repr(i) + '\n'
 
     # Return a GET (BINGET, LONG_BINGET) opcode string, with argument i.
     def get(self, i, pack=struct.pack):
@@ -271,7 +271,7 @@
             else:
                 return LONG_BINGET + pack("<i", i)
 
-        return GET + `i` + '\n'
+        return GET + repr(i) + '\n'
 
     def save(self, obj):
         # Check for persistent id (defined by a subclass)
@@ -469,7 +469,7 @@
                 self.write(BININT + pack("<i", obj))
                 return
         # Text pickle, or int too big to fit in signed 4-byte format.
-        self.write(INT + `obj` + '\n')
+        self.write(INT + repr(obj) + '\n')
     dispatch[IntType] = save_int
 
     def save_long(self, obj, pack=struct.pack):
@@ -481,14 +481,14 @@
             else:
                 self.write(LONG4 + pack("<i", n) + bytes)
             return
-        self.write(LONG + `obj` + '\n')
+        self.write(LONG + repr(obj) + '\n')
     dispatch[LongType] = save_long
 
     def save_float(self, obj, pack=struct.pack):
         if self.bin:
             self.write(BINFLOAT + pack('>d', obj))
         else:
-            self.write(FLOAT + `obj` + '\n')
+            self.write(FLOAT + repr(obj) + '\n')
     dispatch[FloatType] = save_float
 
     def save_string(self, obj, pack=struct.pack):
@@ -499,7 +499,7 @@
             else:
                 self.write(BINSTRING + pack("<i", n) + obj)
         else:
-            self.write(STRING + `obj` + '\n')
+            self.write(STRING + repr(obj) + '\n')
         self.memoize(obj)
     dispatch[StringType] = save_string
 
@@ -539,7 +539,7 @@
                     obj = obj.encode('raw-unicode-escape')
                     self.write(UNICODE + obj + '\n')
                 else:
-                    self.write(STRING + `obj` + '\n')
+                    self.write(STRING + repr(obj) + '\n')
             self.memoize(obj)
         dispatch[StringType] = save_string
 
@@ -1173,12 +1173,12 @@
 
     def load_binget(self):
         i = ord(self.read(1))
-        self.append(self.memo[`i`])
+        self.append(self.memo[repr(i)])
     dispatch[BINGET] = load_binget
 
     def load_long_binget(self):
         i = mloads('i' + self.read(4))
-        self.append(self.memo[`i`])
+        self.append(self.memo[repr(i)])
     dispatch[LONG_BINGET] = load_long_binget
 
     def load_put(self):
@@ -1187,12 +1187,12 @@
 
     def load_binput(self):
         i = ord(self.read(1))
-        self.memo[`i`] = self.stack[-1]
+        self.memo[repr(i)] = self.stack[-1]
     dispatch[BINPUT] = load_binput
 
     def load_long_binput(self):
         i = mloads('i' + self.read(4))
-        self.memo[`i`] = self.stack[-1]
+        self.memo[repr(i)] = self.stack[-1]
     dispatch[LONG_BINPUT] = load_long_binput
 
     def load_append(self):
diff --git a/Lib/pipes.py b/Lib/pipes.py
index 9de22e1..295d9c8 100644
--- a/Lib/pipes.py
+++ b/Lib/pipes.py
@@ -89,8 +89,8 @@
         self.reset()
 
     def __repr__(self):
-        """t.__repr__() implements `t`."""
-        return '<Template instance, steps=' + `self.steps` + '>'
+        """t.__repr__() implements repr(t)."""
+        return '<Template instance, steps=%r>' % (self.steps,)
 
     def reset(self):
         """t.reset() restores a pipeline template to its initial state."""
@@ -115,7 +115,7 @@
                   'Template.append: cmd must be a string'
         if kind not in stepkinds:
             raise ValueError, \
-                  'Template.append: bad kind ' + `kind`
+                  'Template.append: bad kind %r' % (kind,)
         if kind == SOURCE:
             raise ValueError, \
                   'Template.append: SOURCE can only be prepended'
@@ -137,7 +137,7 @@
                   'Template.prepend: cmd must be a string'
         if kind not in stepkinds:
             raise ValueError, \
-                  'Template.prepend: bad kind ' + `kind`
+                  'Template.prepend: bad kind %r' % (kind,)
         if kind == SINK:
             raise ValueError, \
                   'Template.prepend: SINK can only be appended'
@@ -160,7 +160,7 @@
         if rw == 'w':
             return self.open_w(file)
         raise ValueError, \
-              'Template.open: rw must be \'r\' or \'w\', not ' + `rw`
+              'Template.open: rw must be \'r\' or \'w\', not %r' % (rw,)
 
     def open_r(self, file):
         """t.open_r(file) and t.open_w(file) implement
diff --git a/Lib/plat-irix5/cddb.py b/Lib/plat-irix5/cddb.py
index e43aea6..c4a95cd 100755
--- a/Lib/plat-irix5/cddb.py
+++ b/Lib/plat-irix5/cddb.py
@@ -111,9 +111,7 @@
 					print 'syntax error in ' + file
 					continue
 				if trackno > ntracks:
-					print 'track number ' + `trackno` + \
-						  ' in file ' + file + \
-						  ' out of range'
+					print 'track number %r in file %r out of range' % (trackno, file)
 					continue
 				if name2 == 'title':
 					self.track[trackno] = value
@@ -191,7 +189,7 @@
 		prevpref = None
 		for i in range(1, len(self.track)):
 			if self.trackartist[i]:
-				f.write('track'+`i`+'.artist:\t'+self.trackartist[i]+'\n')
+				f.write('track%r.artist:\t%s\n' % (i, self.trackartist[i]))
 			track = self.track[i]
 			try:
 				off = track.index(',')
@@ -202,5 +200,5 @@
 					track = track[off:]
 				else:
 					prevpref = track[:off]
-			f.write('track' + `i` + '.title:\t' + track + '\n')
+			f.write('track%r.title:\t%s\n' % (i, track))
 		f.close()
diff --git a/Lib/plat-irix5/cdplayer.py b/Lib/plat-irix5/cdplayer.py
index 278da03..3cbd0d8 100755
--- a/Lib/plat-irix5/cdplayer.py
+++ b/Lib/plat-irix5/cdplayer.py
@@ -82,8 +82,7 @@
 		new.write(self.id + '.title:\t' + self.title + '\n')
 		new.write(self.id + '.artist:\t' + self.artist + '\n')
 		for i in range(1, len(self.track)):
-			new.write(self.id + '.track.' + `i` + ':\t' + \
-				  self.track[i] + '\n')
+			new.write('%s.track.%r:\t%s\n' % (self.id, i, self.track[i])
 		old.close()
 		new.close()
 		posix.rename(filename + '.new', filename)
diff --git a/Lib/plat-irix5/flp.py b/Lib/plat-irix5/flp.py
index 7d5814a..b22bc1a 100755
--- a/Lib/plat-irix5/flp.py
+++ b/Lib/plat-irix5/flp.py
@@ -146,7 +146,7 @@
     forms = parse_forms(filename)
     altforms = _pack_cache(forms)
     print 'import flp'
-    print 'flp._internal_cache[', `filename`, '] =', altforms
+    print 'flp._internal_cache[', repr(filename), '] =', altforms
 
 #
 # Internal: create the data structure to be placed in the cache
@@ -417,7 +417,7 @@
     elif cl == FL.TEXT: return fm.add_text
     elif cl == FL.TIMER: return fm.add_timer
     else:
-        raise error, 'Unknown object type: ' + `cl`
+        raise error, 'Unknown object type: %r' % (cl,)
 
 
 def test():
diff --git a/Lib/plat-irix5/panel.py b/Lib/plat-irix5/panel.py
index f8388c6..3aa7448 100755
--- a/Lib/plat-irix5/panel.py
+++ b/Lib/plat-irix5/panel.py
@@ -127,7 +127,7 @@
 				ok = 0
 			if ok:
 				lhs = 'target.' + prefix + name
-				stmt = lhs + '=' + `value`
+				stmt = lhs + '=' + repr(value)
 				if debug: print 'exec', stmt
 				try:
 					exec stmt + '\n'
diff --git a/Lib/plat-irix5/readcd.py b/Lib/plat-irix5/readcd.py
index e000d35..f278ba4 100755
--- a/Lib/plat-irix5/readcd.py
+++ b/Lib/plat-irix5/readcd.py
@@ -9,7 +9,7 @@
 
 def _doatime(self, cb_type, data):
 	if ((data[0] * 60) + data[1]) * 75 + data[2] > self.end:
-##		print 'done with list entry',`self.listindex`
+##		print 'done with list entry', repr(self.listindex)
 		raise _Stop
 	func, arg = self.callbacks[cb_type]
 	if func:
@@ -17,7 +17,7 @@
 
 def _dopnum(self, cb_type, data):
 	if data > self.end:
-##		print 'done with list entry',`self.listindex`
+##		print 'done with list entry', repr(self.listindex)
 		raise _Stop
 	func, arg = self.callbacks[cb_type]
 	if func:
diff --git a/Lib/plat-irix5/torgb.py b/Lib/plat-irix5/torgb.py
index 6208289..fa5effb 100755
--- a/Lib/plat-irix5/torgb.py
+++ b/Lib/plat-irix5/torgb.py
@@ -85,13 +85,12 @@
 			type(msg[0]) == type(0) and type(msg[1]) == type(''):
 			msg = msg[1]
 		if type(msg) is not type(''):
-			msg = `msg`
+			msg = repr(msg)
 		raise error, filename + ': ' + msg
 	if ftype == 'rgb':
 		return fname
 	if ftype is None or not table.has_key(ftype):
-		raise error, \
-			filename + ': unsupported image file type ' + `ftype`
+		raise error, '%s: unsupported image file type %r' % (filename, ftype))
 	(fd, temp) = tempfile.mkstemp()
 	os.close(fd)
 	sts = table[ftype].copy(fname, temp)
diff --git a/Lib/plat-irix6/cddb.py b/Lib/plat-irix6/cddb.py
index 96025e7..e96e99e 100644
--- a/Lib/plat-irix6/cddb.py
+++ b/Lib/plat-irix6/cddb.py
@@ -111,9 +111,7 @@
 					print 'syntax error in ' + file
 					continue
 				if trackno > ntracks:
-					print 'track number ' + `trackno` + \
-						  ' in file ' + file + \
-						  ' out of range'
+					print 'track number %r in file %s out of range' % (trackno, file)
 					continue
 				if name2 == 'title':
 					self.track[trackno] = value
@@ -191,7 +189,7 @@
 		prevpref = None
 		for i in range(1, len(self.track)):
 			if self.trackartist[i]:
-				f.write('track'+`i`+'.artist:\t'+self.trackartist[i]+'\n')
+				f.write('track%r.artist:\t%s\n' % (i, self.trackartist[i])
 			track = self.track[i]
 			try:
 				off = track.index(',')
@@ -202,5 +200,5 @@
 					track = track[off:]
 				else:
 					prevpref = track[:off]
-			f.write('track' + `i` + '.title:\t' + track + '\n')
+			f.write('track%r.title:\t%s\n' % (i, track))
 		f.close()
diff --git a/Lib/plat-irix6/cdplayer.py b/Lib/plat-irix6/cdplayer.py
index c665a07..4ba3f51 100644
--- a/Lib/plat-irix6/cdplayer.py
+++ b/Lib/plat-irix6/cdplayer.py
@@ -82,8 +82,7 @@
 		new.write(self.id + '.title:\t' + self.title + '\n')
 		new.write(self.id + '.artist:\t' + self.artist + '\n')
 		for i in range(1, len(self.track)):
-			new.write(self.id + '.track.' + `i` + ':\t' + \
-				  self.track[i] + '\n')
+			new.write('%s.track.%r:\t%s\n' % (i, track))
 		old.close()
 		new.close()
 		posix.rename(filename + '.new', filename)
diff --git a/Lib/plat-irix6/flp.py b/Lib/plat-irix6/flp.py
index 6530487..aa23107 100644
--- a/Lib/plat-irix6/flp.py
+++ b/Lib/plat-irix6/flp.py
@@ -145,7 +145,7 @@
     forms = parse_forms(filename)
     altforms = _pack_cache(forms)
     print 'import flp'
-    print 'flp._internal_cache[', `filename`, '] =', altforms
+    print 'flp._internal_cache[', repr(filename), '] =', altforms
 
 #
 # Internal: create the data structure to be placed in the cache
@@ -416,7 +416,7 @@
     elif cl == FL.TEXT: return fm.add_text
     elif cl == FL.TIMER: return fm.add_timer
     else:
-        raise error, 'Unknown object type: ' + `cl`
+        raise error, 'Unknown object type: %r' % (cl,)
 
 
 def test():
diff --git a/Lib/plat-irix6/panel.py b/Lib/plat-irix6/panel.py
index f8388c6..3aa7448 100644
--- a/Lib/plat-irix6/panel.py
+++ b/Lib/plat-irix6/panel.py
@@ -127,7 +127,7 @@
 				ok = 0
 			if ok:
 				lhs = 'target.' + prefix + name
-				stmt = lhs + '=' + `value`
+				stmt = lhs + '=' + repr(value)
 				if debug: print 'exec', stmt
 				try:
 					exec stmt + '\n'
diff --git a/Lib/plat-irix6/readcd.py b/Lib/plat-irix6/readcd.py
index e000d35..f278ba4 100644
--- a/Lib/plat-irix6/readcd.py
+++ b/Lib/plat-irix6/readcd.py
@@ -9,7 +9,7 @@
 
 def _doatime(self, cb_type, data):
 	if ((data[0] * 60) + data[1]) * 75 + data[2] > self.end:
-##		print 'done with list entry',`self.listindex`
+##		print 'done with list entry', repr(self.listindex)
 		raise _Stop
 	func, arg = self.callbacks[cb_type]
 	if func:
@@ -17,7 +17,7 @@
 
 def _dopnum(self, cb_type, data):
 	if data > self.end:
-##		print 'done with list entry',`self.listindex`
+##		print 'done with list entry', repr(self.listindex)
 		raise _Stop
 	func, arg = self.callbacks[cb_type]
 	if func:
diff --git a/Lib/plat-irix6/torgb.py b/Lib/plat-irix6/torgb.py
index 6208289..c2b1740 100644
--- a/Lib/plat-irix6/torgb.py
+++ b/Lib/plat-irix6/torgb.py
@@ -85,13 +85,12 @@
 			type(msg[0]) == type(0) and type(msg[1]) == type(''):
 			msg = msg[1]
 		if type(msg) is not type(''):
-			msg = `msg`
+			msg = repr(msg)
 		raise error, filename + ': ' + msg
 	if ftype == 'rgb':
 		return fname
 	if ftype is None or not table.has_key(ftype):
-		raise error, \
-			filename + ': unsupported image file type ' + `ftype`
+		raise error, '%s: unsupported image file type %r' % (filename, ftype)
 	(fd, temp) = tempfile.mkstemp()
 	os.close(fd)
 	sts = table[ftype].copy(fname, temp)
diff --git a/Lib/plat-mac/EasyDialogs.py b/Lib/plat-mac/EasyDialogs.py
index 0c54ec3..13df7f3 100644
--- a/Lib/plat-mac/EasyDialogs.py
+++ b/Lib/plat-mac/EasyDialogs.py
@@ -531,7 +531,7 @@
 
             for stringtoadd in stringstoadd:
                 if '"' in stringtoadd or "'" in stringtoadd or " " in stringtoadd:
-                    stringtoadd = `stringtoadd`
+                    stringtoadd = repr(stringtoadd)
                 h = d.GetDialogItemAsControl(ARGV_CMDLINE_DATA)
                 oldstr = GetDialogItemText(h)
                 if oldstr and oldstr[-1] != ' ':
@@ -791,7 +791,7 @@
     argv = GetArgv(optionlist=optionlist, commandlist=commandlist, addoldfile=0)
     Message("Command line: %s"%' '.join(argv))
     for i in range(len(argv)):
-        print 'arg[%d] = %s'%(i, `argv[i]`)
+        print 'arg[%d] = %r' % (i, argv[i])
     ok = AskYesNoCancel("Do you want to proceed?")
     ok = AskYesNoCancel("Do you want to identify?", yes="Identify", no="No")
     if ok > 0:
diff --git a/Lib/plat-mac/FrameWork.py b/Lib/plat-mac/FrameWork.py
index 849ebdf..7242704 100644
--- a/Lib/plat-mac/FrameWork.py
+++ b/Lib/plat-mac/FrameWork.py
@@ -373,7 +373,7 @@
             # else it wasn't for us, sigh...
 
     def do_char(self, c, event):
-        if DEBUG: print "Character", `c`
+        if DEBUG: print "Character", repr(c)
 
     def do_updateEvt(self, event):
         (what, message, when, where, modifiers) = event
@@ -431,13 +431,13 @@
 
     def printevent(self, event):
         (what, message, when, where, modifiers) = event
-        nicewhat = `what`
+        nicewhat = repr(what)
         if eventname.has_key(what):
             nicewhat = eventname[what]
         print nicewhat,
         if what == kHighLevelEvent:
             h, v = where
-            print `ostypecode(message)`, hex(when), `ostypecode(h | (v<<16))`,
+            print repr(ostypecode(message)), hex(when), repr(ostypecode(h | (v<<16))),
         else:
             print hex(message), hex(when), where,
         print hex(modifiers)
diff --git a/Lib/plat-mac/MiniAEFrame.py b/Lib/plat-mac/MiniAEFrame.py
index d6482c6..3c5ed9a 100644
--- a/Lib/plat-mac/MiniAEFrame.py
+++ b/Lib/plat-mac/MiniAEFrame.py
@@ -67,8 +67,7 @@
         what, message, when, where, modifiers = event
         h, v = where
         if what == kHighLevelEvent:
-            msg = "High Level Event: %s %s" % \
-                (`code(message)`, `code(h | (v<<16))`)
+            msg = "High Level Event: %r %r" % (code(message), code(h | (v<<16)))
             try:
                 AE.AEProcessAppleEvent(event)
             except AE.Error, err:
diff --git a/Lib/plat-mac/aetypes.py b/Lib/plat-mac/aetypes.py
index 538cf14..b9386f3 100644
--- a/Lib/plat-mac/aetypes.py
+++ b/Lib/plat-mac/aetypes.py
@@ -26,7 +26,7 @@
         self.data = data
     
     def __repr__(self):
-        return "Unknown(%s, %s)" % (`self.type`, `self.data`)
+        return "Unknown(%r, %r)" % (self.type, self.data)
     
     def __aepack__(self):
         return pack(self.data, self.type)
@@ -38,7 +38,7 @@
         self.enum = "%-4.4s" % str(enum)
     
     def __repr__(self):
-        return "Enum(%s)" % `self.enum`
+        return "Enum(%r)" % (self.enum,)
     
     def __str__(self):
         return string.strip(self.enum)
@@ -60,7 +60,7 @@
         self.pos = pos
     
     def __repr__(self):
-        return "InsertionLoc(%s, %s)" % (`self.of`, `self.pos`)
+        return "InsertionLoc(%r, %r)" % (self.of, self.pos)
         
     def __aepack__(self):
         rec = {'kobj': self.of, 'kpos': self.pos}
@@ -80,7 +80,7 @@
         self.bool = (not not bool)
     
     def __repr__(self):
-        return "Boolean(%s)" % `self.bool`
+        return "Boolean(%r)" % (self.bool,)
     
     def __str__(self):
         if self.bool:
@@ -105,7 +105,7 @@
         self.type = "%-4.4s" % str(type)
     
     def __repr__(self):
-        return "Type(%s)" % `self.type`
+        return "Type(%r)" % (self.type,)
     
     def __str__(self):
         return string.strip(self.type)
@@ -128,7 +128,7 @@
         self.keyword = "%-4.4s" % str(keyword)
     
     def __repr__(self):
-        return "Keyword(%s)" % `self.keyword`
+        return "Keyword(%r)" % `self.keyword`
     
     def __str__(self):
         return string.strip(self.keyword)
@@ -147,7 +147,7 @@
         self.stop = stop
     
     def __repr__(self):
-        return "Range(%s, %s)" % (`self.start`, `self.stop`)
+        return "Range(%r, %r)" % (self.start, self.stop)
     
     def __str__(self):
         return "%s thru %s" % (nice(self.start), nice(self.stop))
@@ -167,7 +167,7 @@
         self.obj2 = obj2
     
     def __repr__(self):
-        return "Comparison(%s, %s, %s)" % (`self.obj1`, `self.relo`, `self.obj2`)
+        return "Comparison(%r, %r, %r)" % (self.obj1, self.relo, self.obj2)
     
     def __str__(self):
         return "%s %s %s" % (nice(self.obj1), string.strip(self.relo), nice(self.obj2))
@@ -195,7 +195,7 @@
         self.abso = "%-4.4s" % str(abso)
     
     def __repr__(self):
-        return "Ordinal(%s)" % (`self.abso`)
+        return "Ordinal(%r)" % (self.abso,)
     
     def __str__(self):
         return "%s" % (string.strip(self.abso))
@@ -220,7 +220,7 @@
         self.term = term
     
     def __repr__(self):
-        return "Logical(%s, %s)" % (`self.logc`, `self.term`)
+        return "Logical(%r, %r)" % (self.logc, self.term)
     
     def __str__(self):
         if type(self.term) == ListType and len(self.term) == 2:
@@ -244,7 +244,7 @@
         self.text = text
     
     def __repr__(self):
-        return "StyledText(%s, %s)" % (`self.style`, `self.text`)
+        return "StyledText(%r, %r)" % (self.style, self.text)
     
     def __str__(self):
         return self.text
@@ -264,7 +264,7 @@
         self.text = text
     
     def __repr__(self):
-        return "AEText(%s, %s, %s)" % (`self.script`, `self.style`, `self.text`)
+        return "AEText(%r, %r, %r)" % (self.script, self.style, self.text)
     
     def __str__(self):
         return self.text
@@ -285,7 +285,7 @@
         self.text = text
     
     def __repr__(self):
-        return "IntlText(%s, %s, %s)" % (`self.script`, `self.language`, `self.text`)
+        return "IntlText(%r, %r, %r)" % (self.script, self.language, self.text)
     
     def __str__(self):
         return self.text
@@ -305,7 +305,7 @@
         self.language = language
     
     def __repr__(self):
-        return "IntlWritingCode(%s, %s)" % (`self.script`, `self.language`)
+        return "IntlWritingCode(%r, %r)" % (self.script, self.language)
     
     def __str__(self):
         return "script system %d, language %d"%(self.script, self.language)
@@ -325,7 +325,7 @@
         self.h = h
     
     def __repr__(self):
-        return "QDPoint(%s, %s)" % (`self.v`, `self.h`)
+        return "QDPoint(%r, %r)" % (self.v, self.h)
     
     def __str__(self):
         return "(%d, %d)"%(self.v, self.h)
@@ -347,8 +347,7 @@
         self.h1 = h1
     
     def __repr__(self):
-        return "QDRectangle(%s, %s, %s, %s)" % (`self.v0`, `self.h0`,
-                `self.v1`, `self.h1`)
+        return "QDRectangle(%r, %r, %r, %r)" % (self.v0, self.h0, self.v1, self.h1)
     
     def __str__(self):
         return "(%d, %d)-(%d, %d)"%(self.v0, self.h0, self.v1, self.h1)
@@ -369,7 +368,7 @@
         self.b = b
             
     def __repr__(self):
-        return "RGBColor(%s, %s, %s)" % (`self.r`, `self.g`, `self.b`)
+        return "RGBColor(%r, %r, %r)" % (self.r, self.g, self.b)
     
     def __str__(self):
         return "0x%x red, 0x%x green, 0x%x blue"% (self.r, self.g, self.b)
@@ -413,9 +412,9 @@
         self.fr = fr
     
     def __repr__(self):
-        s = "ObjectSpecifier(%s, %s, %s" % (`self.want`, `self.form`, `self.seld`)
+        s = "ObjectSpecifier(%r, %r, %r" % (self.want, self.form, self.seld)
         if self.fr:
-            s = s + ", %s)" % `self.fr`
+            s = s + ", %r)" % (self.fr,)
         else:
             s = s + ")"
         return s
@@ -439,9 +438,9 @@
 
     def __repr__(self):
         if self.fr:
-            return "Property(%s, %s)" % (`self.seld.type`, `self.fr`)
+            return "Property(%r, %r)" % (self.seld.type, self.fr)
         else:
-            return "Property(%s)" % `self.seld.type`
+            return "Property(%r)" % (self.seld.type,)
     
     def __str__(self):
         if self.fr:
@@ -465,11 +464,11 @@
                     mktype(self.which), fr)
 
     def __repr__(self):
-        rv = "Property(%s"%`self.seld.type`
+        rv = "Property(%r" % (self.seld.type,)
         if self.fr:
-            rv = rv + ", fr=%s" % `self.fr`
+            rv = rv + ", fr=%r" % (self.fr,)
         if self.want != 'prop':
-            rv = rv + ", want=%s" % `self.want`
+            rv = rv + ", want=%r" % (self.want,)
         return rv + ")"
     
     def __str__(self):
@@ -510,8 +509,8 @@
     
     def __repr__(self):
         if not self.fr:
-            return "%s(%s)" % (self.__class__.__name__, `self.seld`)
-        return "%s(%s, %s)" % (self.__class__.__name__, `self.seld`, `self.fr`)
+            return "%s(%r)" % (self.__class__.__name__, self.seld)
+        return "%s(%r, %r)" % (self.__class__.__name__, self.seld, self.fr)
     
     def __str__(self):
         seld = self.seld
@@ -549,7 +548,7 @@
         return self.compclass(which, self.fr)
         
     def __repr__(self):
-        return "%s(???, %s)" % (self.__class__.__name__, `self.fr`)
+        return "%s(???, %r)" % (self.__class__.__name__, self.fr)
         
     def __str__(self):
         return "selector for element %s of %s"%(self.__class__.__name__, str(self.fr))
diff --git a/Lib/plat-mac/argvemulator.py b/Lib/plat-mac/argvemulator.py
index 90bf365..6103a8a 100644
--- a/Lib/plat-mac/argvemulator.py
+++ b/Lib/plat-mac/argvemulator.py
@@ -52,8 +52,7 @@
             try:
                 AE.AEProcessAppleEvent(event)
             except AE.Error, err:
-                msg = "High Level Event: %s %s" % \
-                    (`hex(message)`, `hex(h | (v<<16))`)
+                msg = "High Level Event: %r %r" % (hex(message), hex(h | (v<<16)))
                 print 'AE error: ', err
                 print 'in', msg
                 traceback.print_exc()
diff --git a/Lib/plat-mac/buildtools.py b/Lib/plat-mac/buildtools.py
index bebab19..365772a 100644
--- a/Lib/plat-mac/buildtools.py
+++ b/Lib/plat-mac/buildtools.py
@@ -55,7 +55,7 @@
         except (Carbon.File.Error, ValueError):
             continue
     else:
-        raise BuildError, "Template %s not found on sys.path" % `template`
+        raise BuildError, "Template %r not found on sys.path" % (template,)
     file = file.as_pathname()
     return file
     
diff --git a/Lib/plat-mac/gensuitemodule.py b/Lib/plat-mac/gensuitemodule.py
index d4140af..ab3c070 100644
--- a/Lib/plat-mac/gensuitemodule.py
+++ b/Lib/plat-mac/gensuitemodule.py
@@ -160,7 +160,7 @@
             res = Get1IndResource('aeut', 1+i)
             resources.append(res)
         if verbose: 
-            print >>verbose, "\nLISTING aete+aeut RESOURCES IN", `fullname`
+            print >>verbose, "\nLISTING aete+aeut RESOURCES IN", repr(fullname)
         aetelist = []
         for res in resources:
             if verbose:
@@ -187,7 +187,7 @@
     if not is_scriptable(fullname) and verbose:
         print >>verbose, "Warning: app does not seem scriptable: %s" % fullname
     if verbose:
-        print >>verbose, "\nASKING FOR aete DICTIONARY IN", `fullname`
+        print >>verbose, "\nASKING FOR aete DICTIONARY IN", repr(fullname)
     try:
         aedescobj, launched = OSATerminology.GetAppTerminology(fullname)
     except MacOS.Error, arg:
@@ -333,7 +333,7 @@
     if f.tell() & 1:
         c = f.read(1)
         ##if c <> '\0':
-        ##  print 'align:', `c`
+        ##  print align:', repr(c)
 
 def getlist(f, description, getitem):
     count = getword(f)
@@ -344,9 +344,9 @@
     return list
 
 def alt_generic(what, f, *args):
-    print "generic", `what`, args
+    print "generic", repr(what), args
     res = vageneric(what, f, args)
-    print '->', `res`
+    print '->', repr(res)
     return res
 
 def generic(what, f, *args):
@@ -358,7 +358,7 @@
             item = apply(generic, thing[:1] + (f,) + thing[1:])
             record.append((thing[1], item))
         return record
-    return "BAD GENERIC ARGS: %s" % `what`
+    return "BAD GENERIC ARGS: %r" % (what,)
 
 getdata = [
     (getostype, "type"),
@@ -529,7 +529,7 @@
         fp.write("_classdeclarations = {\n")
         for codenamemapper in allprecompinfo:
             for k, v in codenamemapper.getall('class'):
-                fp.write("    %s : %s,\n" % (`k`, v))
+                fp.write("    %r : %s,\n" % (k, v))
                 if k == 'capp':
                     application_class = v
         fp.write("}\n")
@@ -540,7 +540,7 @@
         for code, modname in suitelist[1:]:
             fp.write(",\n        %s_Events"%modname)
         fp.write(",\n        aetools.TalkTo):\n")
-        fp.write("    _signature = %s\n\n"%`creatorsignature`)
+        fp.write("    _signature = %r\n\n"%(creatorsignature,))
         fp.write("    _moduleName = '%s'\n\n"%packagename)
         if application_class:
             fp.write("    _elemdict = %s._elemdict\n" % application_class)
@@ -655,7 +655,7 @@
         
         fp.write('import aetools\n')
         fp.write('import MacOS\n\n')
-        fp.write("_code = %s\n\n"% `code`)
+        fp.write("_code = %r\n\n"% (code,))
         if self.basepackage and self.basepackage._code_to_module.has_key(code):
             # We are an extension of a baseclass (usually an application extending
             # Standard_Suite or so). Import everything from our base module
@@ -715,7 +715,7 @@
         if arguments:
             fp.write("    _argmap_%s = {\n"%funcname)
             for a in arguments:
-                fp.write("        %s : %s,\n"%(`identify(a[0])`, `a[1]`))
+                fp.write("        %r : %r,\n"%(identify(a[0]), a[1]))
             fp.write("    }\n\n")
             
         #
@@ -752,8 +752,8 @@
         #
         # Fiddle the args so everything ends up in 'arguments' dictionary
         #
-        fp.write("        _code = %s\n"% `code`)
-        fp.write("        _subcode = %s\n\n"% `subcode`)
+        fp.write("        _code = %r\n"% (code,))
+        fp.write("        _subcode = %r\n\n"% (subcode,))
         #
         # Do keyword name substitution
         #
@@ -780,8 +780,8 @@
                 kname = a[1]
                 ename = a[2][0]
                 if ename <> '****':
-                    fp.write("        aetools.enumsubst(_arguments, %s, _Enum_%s)\n" %
-                        (`kname`, identify(ename)))
+                    fp.write("        aetools.enumsubst(_arguments, %r, _Enum_%s)\n" %
+                        (kname, identify(ename)))
                     self.enumsneeded[ename] = 1
         fp.write("\n")
         #
@@ -971,7 +971,7 @@
             if self.fp:
                 self.fp.write('\nclass %s(aetools.ComponentItem):\n' % pname)
                 self.fp.write('    """%s - %s """\n' % (ascii(name), ascii(desc)))
-                self.fp.write('    want = %s\n' % `code`)
+                self.fp.write('    want = %r\n' % (code,))
         self.namemappers[0].addnamecode('class', pname, code)
         is_application_class = (code == 'capp')
         properties.sort()
@@ -998,8 +998,8 @@
             if self.fp:
                 self.fp.write("class _Prop_%s(aetools.NProperty):\n" % pname)
                 self.fp.write('    """%s - %s """\n' % (ascii(name), ascii(what[1])))
-                self.fp.write("    which = %s\n" % `code`)
-                self.fp.write("    want = %s\n" % `what[0]`)
+                self.fp.write("    which = %r\n" % (code,))
+                self.fp.write("    want = %r\n" % (what[0],))
         self.namemappers[0].addnamecode('property', pname, code)
         if is_application_class and self.fp:
             self.fp.write("%s = _Prop_%s()\n" % (pname, pname))
@@ -1007,7 +1007,7 @@
     def compileelement(self, elem):
         [code, keyform] = elem
         if self.fp:
-            self.fp.write("#        element %s as %s\n" % (`code`, keyform))
+            self.fp.write("#        element %r as %s\n" % (code, keyform))
 
     def fillclasspropsandelems(self, cls):
         [name, code, desc, properties, elements] = cls
@@ -1018,7 +1018,7 @@
             if self.fp and (elements or len(properties) > 1 or (len(properties) == 1 and
                 properties[0][1] != 'c@#!')):
                 if self.verbose:
-                    print >>self.verbose, '** Skip multiple %s of %s (code %s)' % (cname, self.namemappers[0].findcodename('class', code)[0], `code`)
+                    print >>self.verbose, '** Skip multiple %s of %s (code %r)' % (cname, self.namemappers[0].findcodename('class', code)[0], code)
                 raise RuntimeError, "About to skip non-empty class"
             return
         plist = []
@@ -1044,7 +1044,7 @@
                 superclassnames.append(superclassname)
 
         if self.fp:
-            self.fp.write("%s._superclassnames = %s\n"%(cname, `superclassnames`))
+            self.fp.write("%s._superclassnames = %r\n"%(cname, superclassnames))
 
         for elem in elements:
             [ecode, keyform] = elem
@@ -1053,7 +1053,7 @@
             name, ename, module = self.findcodename('class', ecode)
             if not name:
                 if self.fp:
-                    self.fp.write("# XXXX %s element %s not found!!\n"%(cname, `ecode`))
+                    self.fp.write("# XXXX %s element %r not found!!\n"%(cname, ecode))
             else:
                 elist.append((name, ename))
                 
@@ -1091,7 +1091,7 @@
     
     def compileenumerator(self, item):
         [name, code, desc] = item
-        self.fp.write("    %s : %s,\t# %s\n" % (`identify(name)`, `code`, ascii(desc)))
+        self.fp.write("    %r : %r,\t# %s\n" % (identify(name), code, ascii(desc)))
         
     def checkforenum(self, enum):
         """This enum code is used by an event. Make sure it's available"""
@@ -1113,33 +1113,33 @@
         classlist = self.namemappers[0].getall('class')
         classlist.sort()
         for k, v in classlist:
-            self.fp.write("    %s : %s,\n" % (`k`, v))
+            self.fp.write("    %r : %s,\n" % (k, v))
         self.fp.write("}\n")
         
         self.fp.write("\n_propdeclarations = {\n")
         proplist = self.namemappers[0].getall('property')
         proplist.sort()
         for k, v in proplist:
-            self.fp.write("    %s : _Prop_%s,\n" % (`k`, v))
+            self.fp.write("    %r : _Prop_%s,\n" % (k, v))
         self.fp.write("}\n")
         
         self.fp.write("\n_compdeclarations = {\n")
         complist = self.namemappers[0].getall('comparison')
         complist.sort()
         for k, v in complist:
-            self.fp.write("    %s : %s,\n" % (`k`, v))
+            self.fp.write("    %r : %s,\n" % (k, v))
         self.fp.write("}\n")
         
         self.fp.write("\n_enumdeclarations = {\n")
         enumlist = self.namemappers[0].getall('enum')
         enumlist.sort()
         for k, v in enumlist:
-            self.fp.write("    %s : %s,\n" % (`k`, v))
+            self.fp.write("    %r : %s,\n" % (k, v))
         self.fp.write("}\n")
 
 def compiledata(data):
     [type, description, flags] = data
-    return "%s -- %s %s" % (`type`, `description`, compiledataflags(flags))
+    return "%r -- %r %s" % (type, description, compiledataflags(flags))
     
 def is_null(data):
     return data[0] == 'null'
@@ -1158,7 +1158,7 @@
         return 'anything'
     if type == 'obj ':
         return 'an AE object reference'
-    return "undocumented, typecode %s"%`type`
+    return "undocumented, typecode %r"%(type,)
 
 dataflagdict = {15: "optional", 14: "list", 13: "enum", 12: "mutable"}
 def compiledataflags(flags):
@@ -1168,7 +1168,7 @@
             if i in dataflagdict.keys():
                 bits.append(dataflagdict[i])
             else:
-                bits.append(`i`)
+                bits.append(repr(i))
     return '[%s]' % string.join(bits)
     
 def ascii(str):
diff --git a/Lib/plat-mac/ic.py b/Lib/plat-mac/ic.py
index b90aa75..3236805 100644
--- a/Lib/plat-mac/ic.py
+++ b/Lib/plat-mac/ic.py
@@ -35,7 +35,7 @@
         self.data = data
 
     def __repr__(self):
-        return "ICOpaqueData(%s)"%`self.data`
+        return "ICOpaqueData(%r)"%(self.data,)
 
 _ICOpaqueDataType=type(ICOpaqueData(''))
         
@@ -94,7 +94,7 @@
         chr(0) + _code_default(name)
     
 def _code_boolean(data, key):
-    print 'XXXX boolean:', `data`
+    print 'XXXX boolean:', repr(data)
     return chr(data)
     
 def _code_text(data, key):
diff --git a/Lib/plat-riscos/rourl2path.py b/Lib/plat-riscos/rourl2path.py
index 9c21386..494e394 100644
--- a/Lib/plat-riscos/rourl2path.py
+++ b/Lib/plat-riscos/rourl2path.py
@@ -58,12 +58,12 @@
                 "/foo/bar/index.html",
                 "/foo/bar/",
                 "/"]:
-        print `url`, '->', `url2pathname(url)`
+        print '%r -> %r' % (url, url2pathname(url))
     print "*******************************************************"
     for path in ["SCSI::SCSI4.$.Anwendung",
                  "PythonApp:Lib",
                  "PythonApp:Lib.rourl2path/py"]:
-        print `path`, '->', `pathname2url(path)`
+        print '%r -> %r' % (path, pathname2url(path))
 
 if __name__ == '__main__':
     test()
diff --git a/Lib/popen2.py b/Lib/popen2.py
index ebb4ef6..acba602 100644
--- a/Lib/popen2.py
+++ b/Lib/popen2.py
@@ -178,7 +178,7 @@
     w.close()
     got = r.read()
     if got.strip() != expected:
-        raise ValueError("wrote %s read %s" % (`teststr`, `got`))
+        raise ValueError("wrote %r read %r" % (teststr, got))
     print "testing popen3..."
     try:
         r, w, e = popen3([cmd])
@@ -188,10 +188,10 @@
     w.close()
     got = r.read()
     if got.strip() != expected:
-        raise ValueError("wrote %s read %s" % (`teststr`, `got`))
+        raise ValueError("wrote %r read %r" % (teststr, got))
     got = e.read()
     if got:
-        raise ValueError("unexected %s on stderr" % `got`)
+        raise ValueError("unexected %r on stderr" % (got,))
     for inst in _active[:]:
         inst.wait()
     if _active:
diff --git a/Lib/poplib.py b/Lib/poplib.py
index c14b8b7..1475bdc 100644
--- a/Lib/poplib.py
+++ b/Lib/poplib.py
@@ -100,14 +100,14 @@
 
 
     def _putline(self, line):
-        if self._debugging > 1: print '*put*', `line`
+        if self._debugging > 1: print '*put*', repr(line)
         self.sock.sendall('%s%s' % (line, CRLF))
 
 
     # Internal: send one command to the server (through _putline())
 
     def _putcmd(self, line):
-        if self._debugging: print '*cmd*', `line`
+        if self._debugging: print '*cmd*', repr(line)
         self._putline(line)
 
 
@@ -117,7 +117,7 @@
 
     def _getline(self):
         line = self.file.readline()
-        if self._debugging > 1: print '*get*', `line`
+        if self._debugging > 1: print '*get*', repr(line)
         if not line: raise error_proto('-ERR EOF')
         octets = len(line)
         # server can send any combination of CR & LF
@@ -135,7 +135,7 @@
 
     def _getresp(self):
         resp, o = self._getline()
-        if self._debugging > 1: print '*resp*', `resp`
+        if self._debugging > 1: print '*resp*', repr(resp)
         c = resp[:1]
         if c != '+':
             raise error_proto(resp)
@@ -209,7 +209,7 @@
         """
         retval = self._shortcmd('STAT')
         rets = retval.split()
-        if self._debugging: print '*stat*', `rets`
+        if self._debugging: print '*stat*', repr(rets)
         numMessages = int(rets[1])
         sizeMessages = int(rets[2])
         return (numMessages, sizeMessages)
@@ -375,7 +375,7 @@
             match = renewline.match(self.buffer)
         line = match.group(0)
         self.buffer = renewline.sub('' ,self.buffer, 1)
-        if self._debugging > 1: print '*get*', `line`
+        if self._debugging > 1: print '*get*', repr(line)
 
         octets = len(line)
         if line[-2:] == CRLF:
@@ -385,7 +385,7 @@
         return line[:-1], octets
 
     def _putline(self, line):
-        if self._debugging > 1: print '*put*', `line`
+        if self._debugging > 1: print '*put*', repr(line)
         line += CRLF
         bytes = len(line)
         while bytes > 0:
@@ -416,7 +416,7 @@
     (numMsgs, totalSize) = a.stat()
     for i in range(1, numMsgs + 1):
         (header, msg, octets) = a.retr(i)
-        print "Message ", `i`, ':'
+        print "Message %d:" % i
         for line in msg:
             print '   ' + line
         print '-----------------------'
diff --git a/Lib/posixfile.py b/Lib/posixfile.py
index e2eb024..705fe77 100644
--- a/Lib/posixfile.py
+++ b/Lib/posixfile.py
@@ -83,7 +83,7 @@
 
     def fileopen(self, file):
         import types
-        if `type(file)` != "<type 'file'>":
+        if repr(type(file)) != "<type 'file'>":
             raise TypeError, 'posixfile.fileopen() arg must be file object'
         self._file_  = file
         # Copy basic file methods
diff --git a/Lib/pprint.py b/Lib/pprint.py
index d938122..716f35d 100644
--- a/Lib/pprint.py
+++ b/Lib/pprint.py
@@ -212,7 +212,7 @@
     typ = _type(object)
     if typ is str:
         if 'locale' not in _sys.modules:
-            return `object`, True, False
+            return repr(object), True, False
         if "'" in object and '"' not in object:
             closure = '"'
             quotes = {'"': '\\"'}
@@ -226,7 +226,7 @@
             if char.isalpha():
                 write(char)
             else:
-                write(qget(char, `char`[1:-1]))
+                write(qget(char, repr(char)[1:-1]))
         return ("%s%s%s" % (closure, sio.getvalue(), closure)), True, False
 
     r = typ.__repr__
@@ -288,7 +288,7 @@
         del context[objid]
         return format % _commajoin(components), readable, recursive
 
-    rep = `object`
+    rep = repr(object)
     return rep, (rep and not rep.startswith('<')), False
 
 
diff --git a/Lib/pre.py b/Lib/pre.py
index b6dd09b..60db913 100644
--- a/Lib/pre.py
+++ b/Lib/pre.py
@@ -544,7 +544,7 @@
             try:
                 g = self.re.groupindex[g]
             except (KeyError, TypeError):
-                raise IndexError, 'group %s is undefined' % `g`
+                raise IndexError, 'group %r is undefined' % (g,)
         return self.regs[g][0]
 
     def end(self, g = 0):
@@ -560,7 +560,7 @@
             try:
                 g = self.re.groupindex[g]
             except (KeyError, TypeError):
-                raise IndexError, 'group %s is undefined' % `g`
+                raise IndexError, 'group %r is undefined' % (g,)
         return self.regs[g][1]
 
     def span(self, g = 0):
@@ -576,7 +576,7 @@
             try:
                 g = self.re.groupindex[g]
             except (KeyError, TypeError):
-                raise IndexError, 'group %s is undefined' % `g`
+                raise IndexError, 'group %r is undefined' % (g,)
         return self.regs[g]
 
     def groups(self, default=None):
@@ -629,9 +629,9 @@
                 try:
                     g = self.re.groupindex[g]
                 except (KeyError, TypeError):
-                    raise IndexError, 'group %s is undefined' % `g`
+                    raise IndexError, 'group %r is undefined' % (g,)
             if g >= len(self.regs):
-                raise IndexError, 'group %s is undefined' % `g`
+                raise IndexError, 'group %r is undefined' % (g,)
             a, b = self.regs[g]
             if a == -1 or b == -1:
                 result.append(None)
diff --git a/Lib/profile.py b/Lib/profile.py
index 5993442..2dc6e87 100755
--- a/Lib/profile.py
+++ b/Lib/profile.py
@@ -411,7 +411,7 @@
 
     # This method is more useful to profile a single function call.
     def runcall(self, func, *args, **kw):
-        self.set_cmd(`func`)
+        self.set_cmd(repr(func))
         sys.setprofile(self.dispatcher)
         try:
             return func(*args, **kw)
@@ -550,4 +550,4 @@
     # Insert script directory in front of module search path
     sys.path.insert(0, os.path.dirname(filename))
 
-    run('execfile(' + `filename` + ')')
+    run('execfile(%r)' % (filename,))
diff --git a/Lib/pstats.py b/Lib/pstats.py
index 9e202e9..5979a61 100644
--- a/Lib/pstats.py
+++ b/Lib/pstats.py
@@ -117,9 +117,8 @@
             self.stats = arg.stats
             arg.stats = {}
         if not self.stats:
-            raise TypeError,  "Cannot create or construct a " \
-                      + `self.__class__` \
-                      + " object from '" + `arg` + "'"
+            raise TypeError,  "Cannot create or construct a %r object from '%r''" % (
+                              self.__class__, arg)
         return
 
     def get_top_level_stats(self):
@@ -300,9 +299,8 @@
                 count = sel
                 new_list = list[:count]
         if len(list) != len(new_list):
-            msg = msg + "   List reduced from " + `len(list)` \
-                      + " to " + `len(new_list)` + \
-                      " due to restriction <" + `sel` + ">\n"
+            msg = msg + "   List reduced from %r to %r due to restriction <%r>\n" % (
+                         len(list), len(new_list), sel)
 
         return new_list, msg
 
@@ -392,8 +390,7 @@
         indent = ""
         for func in clist:
             name = func_std_string(func)
-            print indent*name_size + name + '(' \
-                      + `call_dict[func]`+')', \
+            print indent*name_size + name + '(%r)' % (call_dict[func],), \
                       f8(self.stats[func][3])
             indent = " "
 
diff --git a/Lib/regsub.py b/Lib/regsub.py
index 9b8fae5..0fc10a5 100644
--- a/Lib/regsub.py
+++ b/Lib/regsub.py
@@ -191,8 +191,8 @@
         fields = split(line, delpat)
         if len(fields) != 3:
             print 'Sorry, not three fields'
-            print 'split:', `fields`
+            print 'split:', repr(fields)
             continue
         [pat, repl, str] = split(line, delpat)
-        print 'sub :', `sub(pat, repl, str)`
-        print 'gsub:', `gsub(pat, repl, str)`
+        print 'sub :', repr(sub(pat, repl, str))
+        print 'gsub:', repr(gsub(pat, repl, str))
diff --git a/Lib/repr.py b/Lib/repr.py
index 0431857..2fa3bab 100644
--- a/Lib/repr.py
+++ b/Lib/repr.py
@@ -2,6 +2,8 @@
 
 __all__ = ["Repr","repr"]
 
+import __builtin__
+
 class Repr:
     def __init__(self):
         self.maxlevel = 6
@@ -22,7 +24,7 @@
         if hasattr(self, 'repr_' + typename):
             return getattr(self, 'repr_' + typename)(x, level)
         else:
-            s = `x`
+            s = __builtin__.repr(x)
             if len(s) > self.maxother:
                 i = max(0, (self.maxother-3)//2)
                 j = max(0, self.maxother-3-i)
@@ -81,15 +83,15 @@
         if n > self.maxdict: s = s + ', ...'
         return '{' + s + '}'
     def repr_str(self, x, level):
-        s = `x[:self.maxstring]`
+        s = __builtin__.repr(x[:self.maxstring])
         if len(s) > self.maxstring:
             i = max(0, (self.maxstring-3)//2)
             j = max(0, self.maxstring-3-i)
-            s = `x[:i] + x[len(x)-j:]`
+            s = __builtin__.repr(x[:i] + x[len(x)-j:])
             s = s[:i] + '...' + s[len(s)-j:]
         return s
     def repr_long(self, x, level):
-        s = `x` # XXX Hope this isn't too slow...
+        s = __builtin__.repr(x) # XXX Hope this isn't too slow...
         if len(s) > self.maxlong:
             i = max(0, (self.maxlong-3)//2)
             j = max(0, self.maxlong-3-i)
@@ -97,7 +99,7 @@
         return s
     def repr_instance(self, x, level):
         try:
-            s = `x`
+            s = __builtin__.repr(x)
             # Bugs in x.__repr__() can cause arbitrary
             # exceptions -- then make up something
         except:
diff --git a/Lib/rexec.py b/Lib/rexec.py
index 203a1e9..5911a3b 100644
--- a/Lib/rexec.py
+++ b/Lib/rexec.py
@@ -552,7 +552,7 @@
         try:
             fp = open(args[0])
         except IOError, msg:
-            print "%s: can't open file %s" % (sys.argv[0], `args[0]`)
+            print "%s: can't open file %r" % (sys.argv[0], args[0])
             return 1
     if fp.isatty():
         try:
diff --git a/Lib/sgmllib.py b/Lib/sgmllib.py
index 987ab9f..7db0a97 100644
--- a/Lib/sgmllib.py
+++ b/Lib/sgmllib.py
@@ -423,18 +423,18 @@
 
     def handle_data(self, data):
         self.testdata = self.testdata + data
-        if len(`self.testdata`) >= 70:
+        if len(repr(self.testdata)) >= 70:
             self.flush()
 
     def flush(self):
         data = self.testdata
         if data:
             self.testdata = ""
-            print 'data:', `data`
+            print 'data:', repr(data)
 
     def handle_comment(self, data):
         self.flush()
-        r = `data`
+        r = repr(data)
         if len(r) > 68:
             r = r[:32] + '...' + r[-32:]
         print 'comment:', r
diff --git a/Lib/shlex.py b/Lib/shlex.py
index ccf9038..6632b87 100644
--- a/Lib/shlex.py
+++ b/Lib/shlex.py
@@ -59,7 +59,7 @@
     def push_token(self, tok):
         "Push a token onto the stack popped by the get_token method"
         if self.debug >= 1:
-            print "shlex: pushing token " + `tok`
+            print "shlex: pushing token " + repr(tok)
         self.pushback.appendleft(tok)
 
     def push_source(self, newstream, newfile=None):
@@ -90,7 +90,7 @@
         if self.pushback:
             tok = self.pushback.popleft()
             if self.debug >= 1:
-                print "shlex: popping token " + `tok`
+                print "shlex: popping token " + repr(tok)
             return tok
         # No pushback.  Get a token.
         raw = self.read_token()
@@ -112,7 +112,7 @@
         # Neither inclusion nor EOF
         if self.debug >= 1:
             if raw != self.eof:
-                print "shlex: token=" + `raw`
+                print "shlex: token=" + repr(raw)
             else:
                 print "shlex: token=EOF"
         return raw
@@ -240,7 +240,7 @@
             result = None
         if self.debug > 1:
             if result:
-                print "shlex: raw token=" + `result`
+                print "shlex: raw token=" + repr(result)
             else:
                 print "shlex: raw token=EOF"
         return result
diff --git a/Lib/site.py b/Lib/site.py
index 7282190..c5f3d95 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -368,7 +368,7 @@
 def _test():
     print "sys.path = ["
     for dir in sys.path:
-        print "    %s," % `dir`
+        print "    %r," % (dir,)
     print "]"
 
 if __name__ == '__main__':
diff --git a/Lib/smtplib.py b/Lib/smtplib.py
index 1af127f..daadee2 100755
--- a/Lib/smtplib.py
+++ b/Lib/smtplib.py
@@ -306,7 +306,7 @@
 
     def send(self, str):
         """Send `str' to the server."""
-        if self.debuglevel > 0: print 'send:', `str`
+        if self.debuglevel > 0: print 'send:', repr(str)
         if self.sock:
             try:
                 self.sock.sendall(str)
@@ -345,7 +345,7 @@
             if line == '':
                 self.close()
                 raise SMTPServerDisconnected("Connection unexpectedly closed")
-            if self.debuglevel > 0: print 'reply:', `line`
+            if self.debuglevel > 0: print 'reply:', repr(line)
             resp.append(line[4:].strip())
             code=line[:3]
             # Check that the error code is syntactically correct.
@@ -666,7 +666,7 @@
             # Hmmm? what's this? -ddm
             # self.esmtp_features['7bit']=""
             if self.has_extn('size'):
-                esmtp_opts.append("size=" + `len(msg)`)
+                esmtp_opts.append("size=%d" % len(msg))
             for option in mail_options:
                 esmtp_opts.append(option)
 
@@ -727,7 +727,7 @@
         if not line:
             break
         msg = msg + line
-    print "Message length is " + `len(msg)`
+    print "Message length is %d" % len(msg)
 
     server = SMTP('localhost')
     server.set_debuglevel(1)
diff --git a/Lib/stringold.py b/Lib/stringold.py
index 2ee0ad9..dd2d584 100644
--- a/Lib/stringold.py
+++ b/Lib/stringold.py
@@ -312,7 +312,7 @@
 
     """
     if type(x) == type(''): s = x
-    else: s = `x`
+    else: s = repr(x)
     n = len(s)
     if n >= width: return s
     sign = ''
diff --git a/Lib/sunaudio.py b/Lib/sunaudio.py
index 86a5b41..3b0ee27 100644
--- a/Lib/sunaudio.py
+++ b/Lib/sunaudio.py
@@ -41,4 +41,4 @@
     print 'Encoding:   ', encoding
     print 'Sample rate:', sample_rate
     print 'Channels:   ', channels
-    print 'Info:       ', `info`
+    print 'Info:       ', repr(info)
diff --git a/Lib/tabnanny.py b/Lib/tabnanny.py
index 251df27..f38a79f 100755
--- a/Lib/tabnanny.py
+++ b/Lib/tabnanny.py
@@ -83,7 +83,7 @@
 
     if os.path.isdir(file) and not os.path.islink(file):
         if verbose:
-            print "%s: listing directory" % `file`
+            print "%r: listing directory" % (file,)
         names = os.listdir(file)
         for name in names:
             fullname = os.path.join(file, name)
@@ -96,35 +96,34 @@
     try:
         f = open(file)
     except IOError, msg:
-        errprint("%s: I/O Error: %s" % (`file`, str(msg)))
+        errprint("%r: I/O Error: %s" % (file, msg))
         return
 
     if verbose > 1:
-        print "checking", `file`, "..."
+        print "checking %r ..." % file
 
     try:
         process_tokens(tokenize.generate_tokens(f.readline))
 
     except tokenize.TokenError, msg:
-        errprint("%s: Token Error: %s" % (`file`, str(msg)))
+        errprint("%r: Token Error: %s" % (file, msg))
         return
 
     except NannyNag, nag:
         badline = nag.get_lineno()
         line = nag.get_line()
         if verbose:
-            print "%s: *** Line %d: trouble in tab city! ***" % (
-                `file`, badline)
-            print "offending line:", `line`
+            print "%r: *** Line %d: trouble in tab city! ***" % (file, badline)
+            print "offending line: %r" % (line,)
             print nag.get_msg()
         else:
             if ' ' in file: file = '"' + file + '"'
             if filename_only: print file
-            else: print file, badline, `line`
+            else: print file, badline, repr(line)
         return
 
     if verbose:
-        print "%s: Clean bill of health." % `file`
+        print "%r: Clean bill of health." % (file,)
 
 class Whitespace:
     # the characters used for space and tab
diff --git a/Lib/telnetlib.py b/Lib/telnetlib.py
index 85e4c46..f073050 100644
--- a/Lib/telnetlib.py
+++ b/Lib/telnetlib.py
@@ -288,7 +288,7 @@
         """
         if IAC in buffer:
             buffer = buffer.replace(IAC, IAC+IAC)
-        self.msg("send %s", `buffer`)
+        self.msg("send %r", buffer)
         self.sock.sendall(buffer)
 
     def read_until(self, match, timeout=None):
@@ -519,7 +519,7 @@
         # The buffer size should be fairly small so as to avoid quadratic
         # behavior in process_rawq() above
         buf = self.sock.recv(50)
-        self.msg("recv %s", `buf`)
+        self.msg("recv %r", buf)
         self.eof = (not buf)
         self.rawq = self.rawq + buf
 
diff --git a/Lib/test/test_asynchat.py b/Lib/test/test_asynchat.py
index 60017e0..e91c572 100644
--- a/Lib/test/test_asynchat.py
+++ b/Lib/test/test_asynchat.py
@@ -42,7 +42,7 @@
         self.buffer = self.buffer + data
 
     def found_terminator(self):
-        print "Received:", `self.buffer`
+        print "Received:", repr(self.buffer)
         self.buffer = ""
         self.close()
 
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py
index 46f3d68..9aa24c2 100644
--- a/Lib/test/test_builtin.py
+++ b/Lib/test/test_builtin.py
@@ -58,7 +58,7 @@
         (' 314', 314),
         ('314 ', 314),
         ('  \t\t  314  \t\t  ', 314),
-        (`sys.maxint`, sys.maxint),
+        (repr(sys.maxint), sys.maxint),
         ('  1x', ValueError),
         ('  1  ', 1),
         ('  1\02  ', ValueError),
@@ -480,7 +480,7 @@
                     except v:
                         pass
 
-        s = `-1-sys.maxint`
+        s = repr(-1-sys.maxint)
         self.assertEqual(int(s)+1, -sys.maxint)
         # should return long
         int(s[1:])
diff --git a/Lib/test/test_contains.py b/Lib/test/test_contains.py
index 04eedf1..e6f5cf7 100644
--- a/Lib/test/test_contains.py
+++ b/Lib/test/test_contains.py
@@ -88,15 +88,15 @@
 # A collection of tests on builtin sequence types
 a = range(10)
 for i in a:
-    check(i in a, "%s not in %s" % (`i`, `a`))
-check(16 not in a, "16 not in %s" % `a`)
-check(a not in a, "%s not in %s" % (`a`, `a`))
+    check(i in a, "%r not in %r" % (i, a))
+check(16 not in a, "16 not in %r" % (a,))
+check(a not in a, "%s not in %r" % (a, a))
 
 a = tuple(a)
 for i in a:
-    check(i in a, "%s not in %s" % (`i`, `a`))
-check(16 not in a, "16 not in %s" % `a`)
-check(a not in a, "%s not in %s" % (`a`, `a`))
+    check(i in a, "%r not in %r" % (i, a))
+check(16 not in a, "16 not in %r" % (a,))
+check(a not in a, "%r not in %r" % (a, a))
 
 class Deviant1:
     """Behaves strangely when compared
diff --git a/Lib/test/test_copy.py b/Lib/test/test_copy.py
index 6e32ddd..bd5a3e1 100644
--- a/Lib/test/test_copy.py
+++ b/Lib/test/test_copy.py
@@ -86,7 +86,7 @@
                  "hello", u"hello\u1234", f.func_code,
                  NewStyle, xrange(10), Classic, max]
         for x in tests:
-            self.assert_(copy.copy(x) is x, `x`)
+            self.assert_(copy.copy(x) is x, repr(x))
 
     def test_copy_list(self):
         x = [1, 2, 3]
@@ -259,7 +259,7 @@
                  "hello", u"hello\u1234", f.func_code,
                  NewStyle, xrange(10), Classic, max]
         for x in tests:
-            self.assert_(copy.deepcopy(x) is x, `x`)
+            self.assert_(copy.deepcopy(x) is x, repr(x))
 
     def test_deepcopy_list(self):
         x = [[1, 2], 3]
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index d0500e6..ccb9fe6 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -500,15 +500,15 @@
         __str__ = __repr__
 
     a = Number(3.14, prec=6)
-    vereq(`a`, "3.14")
+    vereq(repr(a), "3.14")
     vereq(a.prec, 6)
 
     a = Number(a, prec=2)
-    vereq(`a`, "3.1")
+    vereq(repr(a), "3.1")
     vereq(a.prec, 2)
 
     a = Number(234.5)
-    vereq(`a`, "234.5")
+    vereq(repr(a), "234.5")
     vereq(a.prec, 12)
 
 def spamlists():
@@ -2801,8 +2801,8 @@
             vereq(sorteditems(x.__dict__), sorteditems(a.__dict__))
             vereq(y.__class__, b.__class__)
             vereq(sorteditems(y.__dict__), sorteditems(b.__dict__))
-            vereq(`x`, `a`)
-            vereq(`y`, `b`)
+            vereq(repr(x), repr(a))
+            vereq(repr(y), repr(b))
             if verbose:
                 print "a = x =", a
                 print "b = y =", b
@@ -2835,8 +2835,8 @@
     vereq(sorteditems(x.__dict__), sorteditems(a.__dict__))
     vereq(y.__class__, b.__class__)
     vereq(sorteditems(y.__dict__), sorteditems(b.__dict__))
-    vereq(`x`, `a`)
-    vereq(`y`, `b`)
+    vereq(repr(x), repr(a))
+    vereq(repr(y), repr(b))
     if verbose:
         print "a = x =", a
         print "b = y =", b
@@ -2968,13 +2968,13 @@
             else:
                 return I(pow(int(other), int(self), int(mod)))
 
-    vereq(`I(1) + I(2)`, "I(3)")
-    vereq(`I(1) + 2`, "I(3)")
-    vereq(`1 + I(2)`, "I(3)")
-    vereq(`I(2) ** I(3)`, "I(8)")
-    vereq(`2 ** I(3)`, "I(8)")
-    vereq(`I(2) ** 3`, "I(8)")
-    vereq(`pow(I(2), I(3), I(5))`, "I(3)")
+    vereq(repr(I(1) + I(2)), "I(3)")
+    vereq(repr(I(1) + 2), "I(3)")
+    vereq(repr(1 + I(2)), "I(3)")
+    vereq(repr(I(2) ** I(3)), "I(8)")
+    vereq(repr(2 ** I(3)), "I(8)")
+    vereq(repr(I(2) ** 3), "I(8)")
+    vereq(repr(pow(I(2), I(3), I(5))), "I(3)")
     class S(str):
         def __eq__(self, other):
             return self.lower() == other.lower()
diff --git a/Lib/test/test_fcntl.py b/Lib/test/test_fcntl.py
index 530ca0c..1dabfa4 100755
--- a/Lib/test/test_fcntl.py
+++ b/Lib/test/test_fcntl.py
@@ -33,7 +33,7 @@
     lockdata = struct.pack('hh'+start_len+'hh', fcntl.F_WRLCK, 0, 0, 0, 0, 0)
 if lockdata:
     if verbose:
-        print 'struct.pack: ', `lockdata`
+        print 'struct.pack: ', repr(lockdata)
 
 # the example from the library docs
 f = open(filename, 'w')
@@ -44,7 +44,7 @@
 if sys.platform not in ['os2emx']:
     rv = fcntl.fcntl(f.fileno(), fcntl.F_SETLKW, lockdata)
     if verbose:
-        print 'String from fcntl with F_SETLKW: ', `rv`
+        print 'String from fcntl with F_SETLKW: ', repr(rv)
 
 f.close()
 os.unlink(filename)
diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py
index c72fae7..0a76367 100644
--- a/Lib/test/test_generators.py
+++ b/Lib/test/test_generators.py
@@ -236,7 +236,7 @@
     ...         self.right = right
     ...
     ...     def __repr__(self, level=0, indent="    "):
-    ...         s = level*indent + `self.label`
+    ...         s = level*indent + repr(self.label)
     ...         if self.left:
     ...             s = s + "\\n" + self.left.__repr__(level+1, indent)
     ...         if self.right:
diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py
index 6666c13..0eed4bb 100644
--- a/Lib/test/test_grammar.py
+++ b/Lib/test/test_grammar.py
@@ -47,7 +47,7 @@
         try:
             x = eval(s)
         except OverflowError:
-            print "OverflowError on huge integer literal " + `s`
+            print "OverflowError on huge integer literal " + repr(s)
 elif eval('maxint == 9223372036854775807'):
     if eval('-9223372036854775807-1 != -01000000000000000000000'):
         raise TestFailed, 'max negative int'
@@ -58,7 +58,7 @@
         try:
             x = eval(s)
         except OverflowError:
-            print "OverflowError on huge integer literal " + `s`
+            print "OverflowError on huge integer literal " + repr(s)
 else:
     print 'Weird maxint value', maxint
 
diff --git a/Lib/test/test_hash.py b/Lib/test/test_hash.py
index 90e80fc..3d6c9d1 100644
--- a/Lib/test/test_hash.py
+++ b/Lib/test/test_hash.py
@@ -14,7 +14,7 @@
         hashed = map(hash, objlist)
         for h in hashed[1:]:
             if h != hashed[0]:
-                self.fail("hashed values differ: %s" % `objlist`)
+                self.fail("hashed values differ: %r" % (objlist,))
 
     def test_numeric_literals(self):
         self.same_hash(1, 1L, 1.0, 1.0+0.0j)
diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py
index 3a6b7fc..a092265 100644
--- a/Lib/test/test_math.py
+++ b/Lib/test/test_math.py
@@ -91,8 +91,8 @@
 print 'frexp'
 def testfrexp(name, (mant, exp), (emant, eexp)):
     if abs(mant-emant) > eps or exp != eexp:
-        raise TestFailed, '%s returned %s, expected %s'%\
-              (name, `mant, exp`, `emant,eexp`)
+        raise TestFailed, '%s returned %r, expected %r'%\
+              (name, (mant, exp), (emant,eexp))
 
 testfrexp('frexp(-1)', math.frexp(-1), (-0.5, 1))
 testfrexp('frexp(0)', math.frexp(0), (0, 0))
@@ -125,8 +125,8 @@
 print 'modf'
 def testmodf(name, (v1, v2), (e1, e2)):
     if abs(v1-e1) > eps or abs(v2-e2):
-        raise TestFailed, '%s returned %s, expected %s'%\
-              (name, `v1,v2`, `e1,e2`)
+        raise TestFailed, '%s returned %r, expected %r'%\
+              (name, (v1,v2), (e1,e2))
 
 testmodf('modf(1.5)', math.modf(1.5), (0.5, 1.0))
 testmodf('modf(-1.5)', math.modf(-1.5), (-0.5, -1.0))
diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py
index cb84987..a54fbd3 100644
--- a/Lib/test/test_minidom.py
+++ b/Lib/test/test_minidom.py
@@ -1361,7 +1361,7 @@
             print "Test Failed: ", name
             sys.stdout.flush()
             traceback.print_exception(*sys.exc_info())
-            print `sys.exc_info()[1]`
+            print repr(sys.exc_info()[1])
             Node.allnodes = {}
 
 if failed:
diff --git a/Lib/test/test_mpz.py b/Lib/test/test_mpz.py
index dc583ae..be1fd1f 100644
--- a/Lib/test/test_mpz.py
+++ b/Lib/test/test_mpz.py
@@ -6,7 +6,7 @@
     mpz_num = mpz.mpz(num)
     vereq(int(mpz_num), num)
     vereq(long(mpz_num), num)
-    vereq(str(mpz_num), 'mpz(%s)' % `int(num)`)
+    vereq(str(mpz_num), 'mpz(%d)' % int(num))
 
 check_conversion(10)
 check_conversion(10L)
diff --git a/Lib/test/test_poll.py b/Lib/test/test_poll.py
index ed1d736..2ecae69 100644
--- a/Lib/test/test_poll.py
+++ b/Lib/test/test_poll.py
@@ -157,7 +157,7 @@
         elif flags & select.POLLIN:
             line = p.readline()
             if verbose:
-                print `line`
+                print repr(line)
             if not line:
                 if verbose:
                     print 'EOF'
diff --git a/Lib/test/test_popen2.py b/Lib/test/test_popen2.py
index cf3a094..2a15a20 100644
--- a/Lib/test/test_popen2.py
+++ b/Lib/test/test_popen2.py
@@ -49,7 +49,7 @@
     w.close()
     got = r.read()
     if got.strip() != expected:
-        raise ValueError("wrote %s read %s" % (`teststr`, `got`))
+        raise ValueError("wrote %r read %r" % (teststr, got))
     print "testing popen3..."
     try:
         w, r, e = os.popen3([cmd])
@@ -59,10 +59,10 @@
     w.close()
     got = r.read()
     if got.strip() != expected:
-        raise ValueError("wrote %s read %s" % (`teststr`, `got`))
+        raise ValueError("wrote %r read %r" % (teststr, got))
     got = e.read()
     if got:
-        raise ValueError("unexected %s on stderr" % `got`)
+        raise ValueError("unexected %r on stderr" % (got,))
     for inst in popen2._active[:]:
         inst.wait()
     if popen2._active:
diff --git a/Lib/test/test_pprint.py b/Lib/test/test_pprint.py
index a61bb66..27d6b52 100644
--- a/Lib/test/test_pprint.py
+++ b/Lib/test/test_pprint.py
@@ -40,14 +40,14 @@
                      self.a, self.b):
             # module-level convenience functions
             verify(not pprint.isrecursive(safe),
-                   "expected not isrecursive for " + `safe`)
+                   "expected not isrecursive for %r" % (safe,))
             verify(pprint.isreadable(safe),
-                   "expected isreadable for " + `safe`)
+                   "expected isreadable for %r" % (safe,))
             # PrettyPrinter methods
             verify(not pp.isrecursive(safe),
-                   "expected not isrecursive for " + `safe`)
+                   "expected not isrecursive for %r" % (safe,))
             verify(pp.isreadable(safe),
-                   "expected isreadable for " + `safe`)
+                   "expected isreadable for %r" % (safe,))
 
     def test_knotted(self):
         # Verify .isrecursive() and .isreadable() w/ recursion
@@ -74,14 +74,14 @@
         for safe in self.a, self.b, self.d, (self.d, self.d):
             # module-level convenience functions
             verify(not pprint.isrecursive(safe),
-                   "expected not isrecursive for " + `safe`)
+                   "expected not isrecursive for %r" % (safe,))
             verify(pprint.isreadable(safe),
-                   "expected isreadable for " + `safe`)
+                   "expected isreadable for %r" % (safe,))
             # PrettyPrinter methods
             verify(not pp.isrecursive(safe),
-                   "expected not isrecursive for " + `safe`)
+                   "expected not isrecursive for %r" % (safe,))
             verify(pp.isreadable(safe),
-                   "expected isreadable for " + `safe`)
+                   "expected isreadable for %r" % (safe,))
 
     def test_unreadable(self):
         # Not recursive but not readable anyway
@@ -90,14 +90,14 @@
         for unreadable in type(3), pprint, pprint.isrecursive:
             # module-level convenience functions
             verify(not pprint.isrecursive(unreadable),
-                   "expected not isrecursive for " + `unreadable`)
+                   "expected not isrecursive for %r" % (unreadable,))
             verify(not pprint.isreadable(unreadable),
-                   "expected not isreadable for " + `unreadable`)
+                   "expected not isreadable for %r" % (unreadable,))
             # PrettyPrinter methods
             verify(not pp.isrecursive(unreadable),
-                   "expected not isrecursive for " + `unreadable`)
+                   "expected not isrecursive for %r" % (unreadable,))
             verify(not pp.isreadable(unreadable),
-                   "expected not isreadable for " + `unreadable`)
+                   "expected not isreadable for %r" % (unreadable,))
 
     def test_same_as_repr(self):
         # Simple objects, small containers and classes that overwrite __repr__
@@ -174,7 +174,7 @@
     def format(self, object, context, maxlevels, level):
         if isinstance(object, str):
             if ' ' in object:
-                return `object`, 1, 0
+                return repr(object), 1, 0
             else:
                 return object, 0, 0
         else:
diff --git a/Lib/test/test_pty.py b/Lib/test/test_pty.py
index 7a1b7b1..6bf9072 100644
--- a/Lib/test/test_pty.py
+++ b/Lib/test/test_pty.py
@@ -19,7 +19,7 @@
         debug("Calling master_open()")
         master_fd, slave_name = pty.master_open()
         debug("Got master_fd '%d', slave_name '%s'"%(master_fd, slave_name))
-        debug("Calling slave_open(%s)"%`slave_name`)
+        debug("Calling slave_open(%r)"%(slave_name,))
         slave_fd = pty.slave_open(slave_name)
         debug("Got slave_fd '%d'"%slave_fd)
     except OSError:
diff --git a/Lib/test/test_pyexpat.py b/Lib/test/test_pyexpat.py
index 09314c3..f281f8b 100644
--- a/Lib/test/test_pyexpat.py
+++ b/Lib/test/test_pyexpat.py
@@ -216,7 +216,7 @@
     if tag is not entry:
         print "expected L to contain many references to the same string",
         print "(it didn't)"
-        print "L =", `L`
+        print "L =", repr(L)
         break
 
 # Tests of the buffer_text attribute.
@@ -228,8 +228,8 @@
 
     def check(self, expected, label):
         require(self.stuff == expected,
-                "%s\nstuff    = %s\nexpected = %s"
-                % (label, `self.stuff`, `map(unicode, expected)`))
+                "%s\nstuff    = %r\nexpected = %r"
+                % (label, self.stuff, map(unicode, expected)))
 
     def CharacterDataHandler(self, text):
         self.stuff.append(text)
diff --git a/Lib/test/test_repr.py b/Lib/test/test_repr.py
index 29e1687..48d969f 100644
--- a/Lib/test/test_repr.py
+++ b/Lib/test/test_repr.py
@@ -25,12 +25,12 @@
         eq(r("abcdefghijklmnop"),"'abcdefghijklmnop'")
 
         s = "a"*30+"b"*30
-        expected = `s`[:13] + "..." + `s`[-14:]
+        expected = repr(s)[:13] + "..." + repr(s)[-14:]
         eq(r(s), expected)
 
         eq(r("\"'"), repr("\"'"))
         s = "\""*30+"'"*100
-        expected = `s`[:13] + "..." + `s`[-14:]
+        expected = repr(s)[:13] + "..." + repr(s)[-14:]
         eq(r(s), expected)
 
     def test_container(self):
@@ -75,7 +75,7 @@
         eq(r(1.0/3), repr(1.0/3))
 
         n = 10L**100
-        expected = `n`[:18] + "..." + `n`[-19:]
+        expected = repr(n)[:18] + "..." + repr(n)[-19:]
         eq(r(n), expected)
 
     def test_instance(self):
@@ -84,7 +84,7 @@
         eq(r(i1), repr(i1))
 
         i2 = ClassWithRepr("x"*1000)
-        expected = `i2`[:13] + "..." + `i2`[-14:]
+        expected = repr(i2)[:13] + "..." + repr(i2)[-14:]
         eq(r(i2), expected)
 
         i3 = ClassWithFailingRepr()
diff --git a/Lib/test/test_rotor.py b/Lib/test/test_rotor.py
index eeec55a..16a7dcd 100644
--- a/Lib/test/test_rotor.py
+++ b/Lib/test/test_rotor.py
@@ -13,9 +13,9 @@
 B = 'cheese shop'
 
 a = r.encrypt(A)
-print `a`
+print repr(a)
 b = r.encryptmore(B)
-print `b`
+print repr(b)
 
 A1 = r.decrypt(a)
 print A1
diff --git a/Lib/test/test_select.py b/Lib/test/test_select.py
index 6a00fe4..eaec52b 100644
--- a/Lib/test/test_select.py
+++ b/Lib/test/test_select.py
@@ -57,7 +57,7 @@
         if (rfd, wfd, xfd) == ([p], [], []):
             line = p.readline()
             if verbose:
-                print `line`
+                print repr(line)
             if not line:
                 if verbose:
                     print 'EOF'
diff --git a/Lib/test/test_set.py b/Lib/test/test_set.py
index 3b108a1..3a85c76 100644
--- a/Lib/test/test_set.py
+++ b/Lib/test/test_set.py
@@ -426,7 +426,7 @@
 
     def test_repr(self):
         if self.repr is not None:
-            self.assertEqual(`self.set`, self.repr)
+            self.assertEqual(repr(self.set), self.repr)
 
     def test_length(self):
         self.assertEqual(len(self.set), self.length)
@@ -1076,7 +1076,7 @@
 
     def test_deep_copy(self):
         dup = copy.deepcopy(self.set)
-        ##print type(dup), `dup`
+        ##print type(dup), repr(dup)
         dup_list = list(dup); dup_list.sort()
         set_list = list(self.set); set_list.sort()
         self.assertEqual(len(dup_list), len(set_list))
diff --git a/Lib/test/test_sets.py b/Lib/test/test_sets.py
index 9cc586f..4947e6b 100644
--- a/Lib/test/test_sets.py
+++ b/Lib/test/test_sets.py
@@ -12,7 +12,7 @@
 
     def test_repr(self):
         if self.repr is not None:
-            self.assertEqual(`self.set`, self.repr)
+            self.assertEqual(repr(self.set), self.repr)
 
     def test_length(self):
         self.assertEqual(len(self.set), self.length)
@@ -670,7 +670,7 @@
 
     def test_deep_copy(self):
         dup = copy.deepcopy(self.set)
-        ##print type(dup), `dup`
+        ##print type(dup), repr(dup)
         dup_list = list(dup); dup_list.sort()
         set_list = list(self.set); set_list.sort()
         self.assertEqual(len(dup_list), len(set_list))
diff --git a/Lib/test/test_socketserver.py b/Lib/test/test_socketserver.py
index 36396da..cee5593 100644
--- a/Lib/test/test_socketserver.py
+++ b/Lib/test/test_socketserver.py
@@ -43,7 +43,7 @@
     if sock in r:
         return sock.recv(n)
     else:
-        raise RuntimeError, "timed out on %s" % `sock`
+        raise RuntimeError, "timed out on %r" % (sock,)
 
 def testdgram(proto, addr):
     s = socket.socket(proto, socket.SOCK_DGRAM)
diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py
index 1e1092d..0641d9b 100644
--- a/Lib/test/test_struct.py
+++ b/Lib/test/test_struct.py
@@ -48,8 +48,8 @@
 sz = struct.calcsize(fmt)
 sz3 = struct.calcsize(fmt3)
 if sz * 3 != sz3:
-    raise TestFailed, 'inconsistent sizes (3*%s -> 3*%d = %d, %s -> %d)' % (
-        `fmt`, sz, 3*sz, `fmt3`, sz3)
+    raise TestFailed, 'inconsistent sizes (3*%r -> 3*%d = %d, %r -> %d)' % (
+        fmt, sz, 3*sz, fmt3, sz3)
 
 simple_err(struct.pack, 'iii', 3)
 simple_err(struct.pack, 'i', 3, 3, 3)
@@ -120,21 +120,21 @@
 
 for fmt, arg, big, lil, asy in tests:
     if verbose:
-        print `fmt`, `arg`, `big`, `lil`
+        print "%r %r %r %r" % (fmt, arg, big, lil)
     for (xfmt, exp) in [('>'+fmt, big), ('!'+fmt, big), ('<'+fmt, lil),
                         ('='+fmt, ISBIGENDIAN and big or lil)]:
         res = struct.pack(xfmt, arg)
         if res != exp:
-            raise TestFailed, "pack(%s, %s) -> %s # expected %s" % (
-                `fmt`, `arg`, `res`, `exp`)
+            raise TestFailed, "pack(%r, %r) -> %r # expected %r" % (
+                fmt, arg, res, exp)
         n = struct.calcsize(xfmt)
         if n != len(res):
-            raise TestFailed, "calcsize(%s) -> %d # expected %d" % (
-                `xfmt`, n, len(res))
+            raise TestFailed, "calcsize(%r) -> %d # expected %d" % (
+                xfmt, n, len(res))
         rev = struct.unpack(xfmt, res)[0]
         if rev != arg and not asy:
-            raise TestFailed, "unpack(%s, %s) -> (%s,) # expected (%s,)" % (
-                `fmt`, `res`, `rev`, `arg`)
+            raise TestFailed, "unpack(%r, %r) -> (%r,) # expected (%r,)" % (
+                fmt, res, rev, arg)
 
 ###########################################################################
 # Simple native q/Q tests.
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py
index a40190e..4838608 100644
--- a/Lib/test/test_syntax.py
+++ b/Lib/test/test_syntax.py
@@ -18,7 +18,7 @@
         except SyntaxError, err:
             mo = re.search(errtext, str(err))
             if mo is None:
-                self.fail("SyntaxError did not contain '%s'" % `errtext`)
+                self.fail("SyntaxError did not contain '%r'" % (errtext,))
         else:
             self.fail("compile() did not raise SyntaxError")
 
diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py
index 1dd5165..aa8f854 100644
--- a/Lib/test/test_types.py
+++ b/Lib/test/test_types.py
@@ -386,9 +386,9 @@
         a = {}
         b = {}
         for i in range(size):
-            a[`i`] = i
+            a[repr(i)] = i
             if copymode < 0:
-                b[`i`] = i
+                b[repr(i)] = i
         if copymode > 0:
             b = a.copy()
         for i in range(size):
diff --git a/Lib/test/test_univnewlines.py b/Lib/test/test_univnewlines.py
index a6c079b..e91bde7 100644
--- a/Lib/test/test_univnewlines.py
+++ b/Lib/test/test_univnewlines.py
@@ -51,13 +51,13 @@
         fp = open(test_support.TESTFN, self.READMODE)
         data = fp.read()
         self.assertEqual(data, DATA_LF)
-        self.assertEqual(`fp.newlines`, `self.NEWLINE`)
+        self.assertEqual(repr(fp.newlines), repr(self.NEWLINE))
 
     def test_readlines(self):
         fp = open(test_support.TESTFN, self.READMODE)
         data = fp.readlines()
         self.assertEqual(data, DATA_SPLIT)
-        self.assertEqual(`fp.newlines`, `self.NEWLINE`)
+        self.assertEqual(repr(fp.newlines), repr(self.NEWLINE))
 
     def test_readline(self):
         fp = open(test_support.TESTFN, self.READMODE)
@@ -67,7 +67,7 @@
             data.append(d)
             d = fp.readline()
         self.assertEqual(data, DATA_SPLIT)
-        self.assertEqual(`fp.newlines`, `self.NEWLINE`)
+        self.assertEqual(repr(fp.newlines), repr(self.NEWLINE))
 
     def test_seek(self):
         fp = open(test_support.TESTFN, self.READMODE)
diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py
index 00cd7ae..b2d266d 100644
--- a/Lib/test/test_weakref.py
+++ b/Lib/test/test_weakref.py
@@ -176,7 +176,7 @@
         L2 = UserList.UserList(L)
         p2 = weakref.proxy(L2)
         self.assertEqual(p, p2)
-        ## self.assertEqual(`L2`, `p2`)
+        ## self.assertEqual(repr(L2), repr(p2))
         L3 = UserList.UserList(range(10))
         p3 = weakref.proxy(L3)
         self.assertEqual(L3[:], p3[:])
diff --git a/Lib/toaiff.py b/Lib/toaiff.py
index 51752f4..3c8a02b 100644
--- a/Lib/toaiff.py
+++ b/Lib/toaiff.py
@@ -92,13 +92,12 @@
                 type(msg[0]) == type(0) and type(msg[1]) == type(''):
             msg = msg[1]
         if type(msg) != type(''):
-            msg = `msg`
+            msg = repr(msg)
         raise error, filename + ': ' + msg
     if ftype == 'aiff':
         return fname
     if ftype is None or not ftype in table:
-        raise error, \
-                filename + ': unsupported audio file type ' + `ftype`
+        raise error, '%s: unsupported audio file type %r' % (filename, ftype)
     (fd, temp) = tempfile.mkstemp()
     os.close(fd)
     temps.append(temp)
diff --git a/Lib/trace.py b/Lib/trace.py
index b694c15..8a31d8e 100644
--- a/Lib/trace.py
+++ b/Lib/trace.py
@@ -674,7 +674,7 @@
                   ignoremods=ignore_modules, ignoredirs=ignore_dirs,
                   infile=counts_file, outfile=counts_file)
         try:
-            t.run('execfile(' + `progname` + ')')
+            t.run('execfile(%r)' % (progname,))
         except IOError, err:
             _err_exit("Cannot run file %r because: %s" % (sys.argv[0], err))
         except SystemExit:
diff --git a/Lib/unittest.py b/Lib/unittest.py
index 0ec059c..29d90e3 100644
--- a/Lib/unittest.py
+++ b/Lib/unittest.py
@@ -330,7 +330,7 @@
         """
         if not first == second:
             raise self.failureException, \
-                  (msg or '%s != %s' % (`first`, `second`))
+                  (msg or '%r != %r' % (first, second))
 
     def failIfEqual(self, first, second, msg=None):
         """Fail if the two objects are equal as determined by the '=='
@@ -338,7 +338,7 @@
         """
         if first == second:
             raise self.failureException, \
-                  (msg or '%s == %s' % (`first`, `second`))
+                  (msg or '%r == %r' % (first, second))
 
     def failUnlessAlmostEqual(self, first, second, places=7, msg=None):
         """Fail if the two objects are unequal as determined by their
@@ -350,7 +350,7 @@
         """
         if round(second-first, places) != 0:
             raise self.failureException, \
-                  (msg or '%s != %s within %s places' % (`first`, `second`, `places` ))
+                  (msg or '%r != %r within %r places' % (first, second, places))
 
     def failIfAlmostEqual(self, first, second, places=7, msg=None):
         """Fail if the two objects are equal as determined by their
@@ -362,7 +362,7 @@
         """
         if round(second-first, places) == 0:
             raise self.failureException, \
-                  (msg or '%s == %s within %s places' % (`first`, `second`, `places`))
+                  (msg or '%r == %r within %r places' % (first, second, places))
 
     # Synonyms for assertion methods
 
diff --git a/Lib/urllib.py b/Lib/urllib.py
index 5449104..bf983e5 100644
--- a/Lib/urllib.py
+++ b/Lib/urllib.py
@@ -794,8 +794,8 @@
                 self.next = self.fp.next
 
     def __repr__(self):
-        return '<%s at %s whose fp = %s>' % (self.__class__.__name__,
-                                             `id(self)`, `self.fp`)
+        return '<%s at %r whose fp = %r>' % (self.__class__.__name__,
+                                             id(self), self.fp)
 
     def close(self):
         self.read = None
@@ -1407,9 +1407,9 @@
     t1 = time.time()
     if uqs != s:
         print 'Wrong!'
-    print `s`
-    print `qs`
-    print `uqs`
+    print repr(s)
+    print repr(qs)
+    print repr(uqs)
     print round(t1 - t0, 3), 'sec'
 
 
diff --git a/Lib/warnings.py b/Lib/warnings.py
index c2bc06e..c6e6006 100644
--- a/Lib/warnings.py
+++ b/Lib/warnings.py
@@ -110,8 +110,8 @@
     else:
         # Unrecognized actions are errors
         raise RuntimeError(
-              "Unrecognized action (%s) in warnings.filters:\n %s" %
-              (`action`, str(item)))
+              "Unrecognized action (%r) in warnings.filters:\n %s" %
+              (action, item))
     # Print message and context
     showwarning(message, category, filename, lineno)
 
@@ -139,7 +139,7 @@
     Use assertions to check that all arguments have the right type."""
     import re
     assert action in ("error", "ignore", "always", "default", "module",
-                      "once"), "invalid action: %s" % `action`
+                      "once"), "invalid action: %r" % (action,)
     assert isinstance(message, basestring), "message must be a string"
     assert isinstance(category, types.ClassType), "category must be a class"
     assert issubclass(category, Warning), "category must be a Warning subclass"
@@ -159,7 +159,7 @@
     A simple filter matches all modules and messages.
     """
     assert action in ("error", "ignore", "always", "default", "module",
-                      "once"), "invalid action: %s" % `action`
+                      "once"), "invalid action: %r" % (action,)
     assert isinstance(lineno, int) and lineno >= 0, \
            "lineno must be an int >= 0"
     item = (action, None, category, None, lineno)
@@ -189,7 +189,7 @@
     import re
     parts = arg.split(':')
     if len(parts) > 5:
-        raise _OptionError("too many fields (max 5): %s" % `arg`)
+        raise _OptionError("too many fields (max 5): %r" % (arg,))
     while len(parts) < 5:
         parts.append('')
     action, message, category, module, lineno = [s.strip()
@@ -206,7 +206,7 @@
             if lineno < 0:
                 raise ValueError
         except (ValueError, OverflowError):
-            raise _OptionError("invalid lineno %s" % `lineno`)
+            raise _OptionError("invalid lineno %r" % (lineno,))
     else:
         lineno = 0
     filterwarnings(action, message, category, module, lineno)
@@ -219,7 +219,7 @@
     for a in ['default', 'always', 'ignore', 'module', 'once', 'error']:
         if a.startswith(action):
             return a
-    raise _OptionError("invalid action: %s" % `action`)
+    raise _OptionError("invalid action: %r" % (action,))
 
 # Helper for _setoption()
 def _getcategory(category):
@@ -230,7 +230,7 @@
         try:
             cat = eval(category)
         except NameError:
-            raise _OptionError("unknown warning category: %s" % `category`)
+            raise _OptionError("unknown warning category: %r" % (category,))
     else:
         i = category.rfind(".")
         module = category[:i]
@@ -238,14 +238,14 @@
         try:
             m = __import__(module, None, None, [klass])
         except ImportError:
-            raise _OptionError("invalid module name: %s" % `module`)
+            raise _OptionError("invalid module name: %r" % (module,))
         try:
             cat = getattr(m, klass)
         except AttributeError:
-            raise _OptionError("unknown warning category: %s" % `category`)
+            raise _OptionError("unknown warning category: %r" % (category,))
     if (not isinstance(cat, types.ClassType) or
         not issubclass(cat, Warning)):
-        raise _OptionError("invalid warning category: %s" % `category`)
+        raise _OptionError("invalid warning category: %r" % (category,))
     return cat
 
 # Module initialization
diff --git a/Lib/wave.py b/Lib/wave.py
index d41a9bd..29e15a0 100644
--- a/Lib/wave.py
+++ b/Lib/wave.py
@@ -261,7 +261,7 @@
             sampwidth = struct.unpack('<h', chunk.read(2))[0]
             self._sampwidth = (sampwidth + 7) // 8
         else:
-            raise Error, 'unknown format: ' + `wFormatTag`
+            raise Error, 'unknown format: %r' % (wFormatTag,)
         self._framesize = self._nchannels * self._sampwidth
         self._comptype = 'NONE'
         self._compname = 'not compressed'
diff --git a/Lib/xdrlib.py b/Lib/xdrlib.py
index dfb9742..1123090 100644
--- a/Lib/xdrlib.py
+++ b/Lib/xdrlib.py
@@ -211,7 +211,7 @@
             x = self.unpack_uint()
             if x == 0: break
             if x != 1:
-                raise ConversionError, '0 or 1 expected, got ' + `x`
+                raise ConversionError, '0 or 1 expected, got %r' % (x,)
             item = unpack_item()
             list.append(item)
         return list
diff --git a/Lib/xml/dom/domreg.py b/Lib/xml/dom/domreg.py
index 117ca49..684c436 100644
--- a/Lib/xml/dom/domreg.py
+++ b/Lib/xml/dom/domreg.py
@@ -87,7 +87,7 @@
     while i < length:
         feature = parts[i]
         if feature[0] in "0123456789":
-            raise ValueError, "bad feature name: " + `feature`
+            raise ValueError, "bad feature name: %r" % (feature,)
         i = i + 1
         version = None
         if i < length:
diff --git a/Lib/xml/dom/minidom.py b/Lib/xml/dom/minidom.py
index a5ebe5f..f17578b 100644
--- a/Lib/xml/dom/minidom.py
+++ b/Lib/xml/dom/minidom.py
@@ -622,9 +622,9 @@
 
     def __repr__(self):
         if self.namespace:
-            return "<TypeInfo %s (from %s)>" % (`self.name`, `self.namespace`)
+            return "<TypeInfo %r (from %r)>" % (self.name, self.namespace)
         else:
-            return "<TypeInfo %s>" % `self.name`
+            return "<TypeInfo %r>" % self.name
 
     def _get_name(self):
         return self.name
diff --git a/Lib/xml/dom/xmlbuilder.py b/Lib/xml/dom/xmlbuilder.py
index fd43c37..5c04412 100644
--- a/Lib/xml/dom/xmlbuilder.py
+++ b/Lib/xml/dom/xmlbuilder.py
@@ -81,7 +81,7 @@
                 settings = self._settings[(_name_xform(name), state)]
             except KeyError:
                 raise xml.dom.NotSupportedErr(
-                    "unsupported feature: " + `name`)
+                    "unsupported feature: %r" % (name,))
             else:
                 for name, value in settings:
                     setattr(self._options, name, value)
diff --git a/Lib/xmllib.py b/Lib/xmllib.py
index cdc861e..f1cd2e4 100644
--- a/Lib/xmllib.py
+++ b/Lib/xmllib.py
@@ -817,30 +817,30 @@
 
     def handle_doctype(self, tag, pubid, syslit, data):
         self.flush()
-        print 'DOCTYPE:',tag, `data`
+        print 'DOCTYPE:',tag, repr(data)
 
     def handle_data(self, data):
         self.testdata = self.testdata + data
-        if len(`self.testdata`) >= 70:
+        if len(repr(self.testdata)) >= 70:
             self.flush()
 
     def flush(self):
         data = self.testdata
         if data:
             self.testdata = ""
-            print 'data:', `data`
+            print 'data:', repr(data)
 
     def handle_cdata(self, data):
         self.flush()
-        print 'cdata:', `data`
+        print 'cdata:', repr(data)
 
     def handle_proc(self, name, data):
         self.flush()
-        print 'processing:',name,`data`
+        print 'processing:',name,repr(data)
 
     def handle_comment(self, data):
         self.flush()
-        r = `data`
+        r = repr(data)
         if len(r) > 68:
             r = r[:32] + '...' + r[-32:]
         print 'comment:', r