? diff.txt ? Mac/Python Index: Demo/classes/Complex.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/classes/Complex.py,v retrieving revision 1.6 diff -u -r1.6 Complex.py --- Demo/classes/Complex.py 24 Apr 2003 17:08:22 -0000 1.6 +++ Demo/classes/Complex.py 1 Dec 2003 22:48:35 -0000 @@ -117,15 +117,15 @@ def __repr__(self): if not self.im: - return 'Complex(%s)' % `self.re` + return 'Complex(%r)' % (self.re,) else: - return 'Complex(%s, %s)' % (`self.re`, `self.im`) + return 'Complex(%r, %r)' % (self.re, self.im) def __str__(self): if not self.im: - return `self.re` + return repr(self.re) else: - return 'Complex(%s, %s)' % (`self.re`, `self.im`) + return 'Complex(%r, %r)' % (self.re, self.im) def __neg__(self): return Complex(-self.re, -self.im) Index: Demo/classes/Dates.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/classes/Dates.py,v retrieving revision 1.4 diff -u -r1.4 Dates.py --- Demo/classes/Dates.py 7 Jun 2003 19:39:56 -0000 1.4 +++ Demo/classes/Dates.py 1 Dec 2003 22:48:35 -0000 @@ -86,7 +86,7 @@ def _num2date( n ): # return date with ordinal n if type(n) not in _INT_TYPES: - raise TypeError, 'argument must be integer: ' + `type(n)` + raise TypeError, 'argument must be integer: %r' % type(n) ans = Date(1,1,1) # arguments irrelevant; just getting a Date obj del ans.ord, ans.month, ans.day, ans.year # un-initialize it @@ -120,10 +120,10 @@ class Date: def __init__( self, month, day, year ): if not 1 <= month <= 12: - raise ValueError, 'month must be in 1..12: ' + `month` + raise ValueError, 'month must be in 1..12: %r' % (month,) dim = _days_in_month( month, year ) if not 1 <= day <= dim: - raise ValueError, 'day must be in 1..' + `dim` + ': ' + `day` + raise ValueError, 'day must be in 1..%r: %r' % (dim, day) self.month, self.day, self.year = month, day, year self.ord = _date2num( self ) @@ -142,15 +142,16 @@ # print as, e.g., Mon 16 Aug 1993 def __repr__( self ): - return '%.3s %2d %.3s ' % ( + return '%.3s %2d %.3s %r' % ( self.weekday(), self.day, - _MONTH_NAMES[self.month-1] ) + `self.year` + _MONTH_NAMES[self.month-1], + self.year) # Python 1.1 coerces neither int+date nor date+int def __add__( self, n ): if type(n) not in _INT_TYPES: - raise TypeError, 'can\'t add ' + `type(n)` + ' to date' + raise TypeError, 'can\'t add %r to date' % type(n) return _num2date( self.ord + n ) __radd__ = __add__ # handle int+date @@ -177,7 +178,7 @@ def test( firstyear, lastyear ): a = Date(9,30,1913) b = Date(9,30,1914) - if `a` != 'Tue 30 Sep 1913': + if repr(a) != 'Tue 30 Sep 1913': raise DateTestError, '__repr__ failure' if (not a < b) or a == b or a > b or b != b: raise DateTestError, '__cmp__ failure' Index: Demo/classes/Dbm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/classes/Dbm.py,v retrieving revision 1.4 diff -u -r1.4 Dbm.py --- Demo/classes/Dbm.py 24 Apr 2003 17:08:23 -0000 1.4 +++ Demo/classes/Dbm.py 1 Dec 2003 22:48:35 -0000 @@ -13,7 +13,7 @@ def __repr__(self): s = '' for key in self.keys(): - t = `key` + ': ' + `self[key]` + t = repr(key) + ': ' + repr(self[key]) if s: t = ', ' + t s = s + t return '{' + s + '}' @@ -22,13 +22,13 @@ return len(self.db) def __getitem__(self, key): - return eval(self.db[`key`]) + return eval(self.db[repr(key)]) def __setitem__(self, key, value): - self.db[`key`] = `value` + self.db[repr(key)] = repr(value) def __delitem__(self, key): - del self.db[`key`] + del self.db[repr(key)] def keys(self): res = [] @@ -37,7 +37,7 @@ return res def has_key(self, key): - return self.db.has_key(`key`) + return self.db.has_key(repr(key)) def test(): Index: Demo/classes/Range.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/classes/Range.py,v retrieving revision 1.5 diff -u -r1.5 Range.py --- Demo/classes/Range.py 24 Apr 2003 17:08:23 -0000 1.5 +++ Demo/classes/Range.py 1 Dec 2003 22:48:35 -0000 @@ -34,9 +34,9 @@ self.step = step self.len = max(0, int((self.stop - self.start) / self.step)) - # implement `x` and is also used by print x + # implement repr(x) and is also used by print x def __repr__(self): - return 'range' + `self.start, self.stop, self.step` + return 'range(%r, %r, %r)' % (self.start, self.stop, self.step) # implement len(x) def __len__(self): Index: Demo/classes/bitvec.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/classes/bitvec.py,v retrieving revision 1.4 diff -u -r1.4 bitvec.py --- Demo/classes/bitvec.py 24 Apr 2003 17:08:24 -0000 1.4 +++ Demo/classes/bitvec.py 1 Dec 2003 22:48:36 -0000 @@ -20,7 +20,7 @@ mant, l = math.frexp(float(param)) bitmask = 1L << l if bitmask <= param: - raise 'FATAL', '(param, l) = ' + `param, l` + raise 'FATAL', '(param, l) = %r' % ((param, l),) while l: bitmask = bitmask >> 1 if param & bitmask: @@ -167,10 +167,10 @@ def __repr__(self): ##rprt('.' + '__repr__()\n') - return 'bitvec' + `self._data, self._len` + return 'bitvec(%r, %r)' % (self._data, self._len) def __cmp__(self, other, *rest): - #rprt(`self`+'.__cmp__'+`(other, ) + rest`+'\n') + #rprt('%r.__cmp__%r\n' % (self, (other,) + rest)) if type(other) != type(self): other = apply(bitvec, (other, ) + rest) #expensive solution... recursive binary, with slicing @@ -193,16 +193,16 @@ def __len__(self): - #rprt(`self`+'.__len__()\n') + #rprt('%r.__len__()\n' % (self,)) return self._len def __getitem__(self, key): - #rprt(`self`+'.__getitem__('+`key`+')\n') + #rprt('%r.__getitem__(%r)\n' % (self, key)) key = _check_key(self._len, key) return self._data & (1L << key) != 0 def __setitem__(self, key, value): - #rprt(`self`+'.__setitem__'+`key, value`+'\n') + #rprt('%r.__setitem__(%r, %r)\n' % (self, key, value)) key = _check_key(self._len, key) #_check_value(value) if value: @@ -211,14 +211,14 @@ self._data = self._data & ~(1L << key) def __delitem__(self, key): - #rprt(`self`+'.__delitem__('+`key`+')\n') + #rprt('%r.__delitem__(%r)\n' % (self, key)) key = _check_key(self._len, key) #el cheapo solution... self._data = self[:key]._data | self[key+1:]._data >> key self._len = self._len - 1 def __getslice__(self, i, j): - #rprt(`self`+'.__getslice__'+`i, j`+'\n') + #rprt('%r.__getslice__(%r, %r)\n' % (self, i, j)) i, j = _check_slice(self._len, i, j) if i >= j: return BitVec(0L, 0) @@ -234,7 +234,7 @@ return BitVec(ndata, nlength) def __setslice__(self, i, j, sequence, *rest): - #rprt(`self`+'.__setslice__'+`(i, j, sequence) + rest`+'\n') + #rprt('%s.__setslice__%r\n' % (self, (i, j, sequence) + rest)) i, j = _check_slice(self._len, i, j) if type(sequence) != type(self): sequence = apply(bitvec, (sequence, ) + rest) @@ -247,7 +247,7 @@ self._len = self._len - j + i + sequence._len def __delslice__(self, i, j): - #rprt(`self`+'.__delslice__'+`i, j`+'\n') + #rprt('%r.__delslice__(%r, %r)\n' % (self, i, j)) i, j = _check_slice(self._len, i, j) if i == 0 and j == self._len: self._data, self._len = 0L, 0 @@ -256,13 +256,13 @@ self._len = self._len - j + i def __add__(self, other): - #rprt(`self`+'.__add__('+`other`+')\n') + #rprt('%r.__add__(%r)\n' % (self, other)) retval = self.copy() retval[self._len:self._len] = other return retval def __mul__(self, multiplier): - #rprt(`self`+'.__mul__('+`multiplier`+')\n') + #rprt('%r.__mul__(%r)\n' % (self, multiplier)) if type(multiplier) != type(0): raise TypeError, 'sequence subscript not int' if multiplier <= 0: @@ -281,7 +281,7 @@ return retval def __and__(self, otherseq, *rest): - #rprt(`self`+'.__and__'+`(otherseq, ) + rest`+'\n') + #rprt('%r.__and__%r\n' % (self, (otherseq,) + rest)) if type(otherseq) != type(self): otherseq = apply(bitvec, (otherseq, ) + rest) #sequence is now of our own type @@ -290,7 +290,7 @@ def __xor__(self, otherseq, *rest): - #rprt(`self`+'.__xor__'+`(otherseq, ) + rest`+'\n') + #rprt('%r.__xor__%r\n' % (self, (otherseq,) + rest)) if type(otherseq) != type(self): otherseq = apply(bitvec, (otherseq, ) + rest) #sequence is now of our own type @@ -299,7 +299,7 @@ def __or__(self, otherseq, *rest): - #rprt(`self`+'.__or__'+`(otherseq, ) + rest`+'\n') + #rprt('%r.__or__%r\n' % (self, (otherseq,) + rest)) if type(otherseq) != type(self): otherseq = apply(bitvec, (otherseq, ) + rest) #sequence is now of our own type @@ -308,13 +308,13 @@ def __invert__(self): - #rprt(`self`+'.__invert__()\n') + #rprt('%r.__invert__()\n' % (self,)) return BitVec(~self._data & ((1L << self._len) - 1), \ self._len) def __coerce__(self, otherseq, *rest): #needed for *some* of the arithmetic operations - #rprt(`self`+'.__coerce__'+`(otherseq, ) + rest`+'\n') + #rprt('%r.__coerce__%r\n' % (self, (otherseq,) + rest)) if type(otherseq) != type(self): otherseq = apply(bitvec, (otherseq, ) + rest) return self, otherseq Index: Demo/metaclasses/Enum.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/metaclasses/Enum.py,v retrieving revision 1.3 diff -u -r1.3 Enum.py --- Demo/metaclasses/Enum.py 14 Sep 1998 16:44:10 -0000 1.3 +++ Demo/metaclasses/Enum.py 1 Dec 2003 22:48:38 -0000 @@ -107,9 +107,9 @@ return self.__value def __repr__(self): - return "EnumInstance(%s, %s, %s)" % (`self.__classname`, - `self.__enumname`, - `self.__value`) + return "EnumInstance(%r, %r, %r)" % (self.__classname, + self.__enumname, + self.__value) def __str__(self): return "%s.%s" % (self.__classname, self.__enumname) Index: Demo/metaclasses/Meta.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/metaclasses/Meta.py,v retrieving revision 1.4 diff -u -r1.4 Meta.py --- Demo/metaclasses/Meta.py 15 Jan 2001 16:53:58 -0000 1.4 +++ Demo/metaclasses/Meta.py 1 Dec 2003 22:48:38 -0000 @@ -98,7 +98,7 @@ def __init__(self, *args): print "__init__, args =", args def m1(self, x): - print "m1(x=%s)" %`x` + print "m1(x=%r)" % (x,) print C x = C() print x Index: Demo/metaclasses/Trace.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/metaclasses/Trace.py,v retrieving revision 1.3 diff -u -r1.3 Trace.py --- Demo/metaclasses/Trace.py 14 Sep 1998 16:44:11 -0000 1.3 +++ Demo/metaclasses/Trace.py 1 Dec 2003 22:48:38 -0000 @@ -117,7 +117,7 @@ def m2(self, y): return self.x + y __trace_output__ = sys.stdout class D(C): - def m2(self, y): print "D.m2(%s)" % `y`; return C.m2(self, y) + def m2(self, y): print "D.m2(%r)" % (y,); return C.m2(self, y) __trace_output__ = None x = C(4321) print x Index: Demo/newmetaclasses/Enum.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/newmetaclasses/Enum.py,v retrieving revision 1.1 diff -u -r1.1 Enum.py --- Demo/newmetaclasses/Enum.py 11 Jul 2002 21:08:06 -0000 1.1 +++ Demo/newmetaclasses/Enum.py 1 Dec 2003 22:48:39 -0000 @@ -97,7 +97,7 @@ print Color.red - print `Color.red` + print repr(Color.red) print Color.red == Color.red print Color.red == Color.blue print Color.red == 1 @@ -139,7 +139,7 @@ print Color.red - print `Color.red` + print repr(Color.red) print Color.red == Color.red print Color.red == Color.blue print Color.red == 1 Index: Demo/pdist/RCSProxy.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/pdist/RCSProxy.py,v retrieving revision 1.6 diff -u -r1.6 RCSProxy.py --- Demo/pdist/RCSProxy.py 14 Sep 1998 16:43:55 -0000 1.6 +++ Demo/pdist/RCSProxy.py 1 Dec 2003 22:48:39 -0000 @@ -188,7 +188,7 @@ if callable(attr): print apply(attr, tuple(sys.argv[2:])) else: - print `attr` + print repr(attr) else: print "%s: no such attribute" % what sys.exit(2) Index: Demo/pdist/client.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/pdist/client.py,v retrieving revision 1.4 diff -u -r1.4 client.py --- Demo/pdist/client.py 7 Oct 1995 19:27:20 -0000 1.4 +++ Demo/pdist/client.py 1 Dec 2003 22:48:39 -0000 @@ -139,7 +139,7 @@ line = self._rf.readline() challenge = string.atoi(string.strip(line)) response = self._encode_challenge(challenge) - line = `long(response)` + line = repr(long(response)) if line[-1] in 'Ll': line = line[:-1] self._wf.write(line + '\n') self._wf.flush() Index: Demo/pdist/cmdfw.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/pdist/cmdfw.py,v retrieving revision 1.2 diff -u -r1.2 cmdfw.py --- Demo/pdist/cmdfw.py 27 Apr 1995 23:32:47 -0000 1.2 +++ Demo/pdist/cmdfw.py 1 Dec 2003 22:48:39 -0000 @@ -55,7 +55,7 @@ try: method = getattr(self, mname) except AttributeError: - return self.usage("command %s unknown" % `cmd`) + return self.usage("command %r unknown" % (cmd,)) try: flags = getattr(self, fname) except AttributeError: @@ -75,7 +75,7 @@ print "-"*40 print "Options:" for o, a in opts: - print 'option', o, 'value', `a` + print 'option', o, 'value', repr(a) print "-"*40 def ready(self): @@ -137,7 +137,7 @@ for t in tests: print '-'*10, t, '-'*10 sts = x.run(t) - print "Exit status:", `sts` + print "Exit status:", repr(sts) if __name__ == '__main__': Index: Demo/pdist/cmptree.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/pdist/cmptree.py,v retrieving revision 1.2 diff -u -r1.2 cmptree.py --- Demo/pdist/cmptree.py 26 Apr 1995 22:57:06 -0000 1.2 +++ Demo/pdist/cmptree.py 1 Dec 2003 22:48:39 -0000 @@ -49,7 +49,7 @@ def compare(local, remote, mode): print - print "PWD =", `os.getcwd()` + print "PWD =", repr(os.getcwd()) sums_id = remote._send('sumlist') subdirs_id = remote._send('listsubdirs') remote._flush() @@ -64,13 +64,13 @@ for name, rsum in sums: rsumdict[name] = rsum if not lsumdict.has_key(name): - print `name`, "only remote" + print repr(name), "only remote" if 'r' in mode and 'c' in mode: recvfile(local, remote, name) else: lsum = lsumdict[name] if lsum != rsum: - print `name`, + print repr(name), rmtime = remote.mtime(name) lmtime = local.mtime(name) if rmtime > lmtime: @@ -86,7 +86,7 @@ print for name in lsumdict.keys(): if not rsumdict.keys(): - print `name`, "only locally", + print repr(name), "only locally", fl() if 'w' in mode and 'c' in mode: sendfile(local, remote, name) @@ -160,7 +160,7 @@ return rv finally: if not ok: - print "*** recvfile of %s failed, deleting" % `name` + print "*** recvfile of %r failed, deleting" % (name,) local.delete(name) def recvfile_real(local, remote, name): Index: Demo/pdist/cvslock.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/pdist/cvslock.py,v retrieving revision 1.1 diff -u -r1.1 cvslock.py --- Demo/pdist/cvslock.py 23 Jun 1995 22:03:28 -0000 1.1 +++ Demo/pdist/cvslock.py 1 Dec 2003 22:48:40 -0000 @@ -114,7 +114,7 @@ self.delay = delay self.lockdir = None self.lockfile = None - pid = `os.getpid()` + pid = repr(os.getpid()) self.cvslck = self.join(CVSLCK) self.cvsrfl = self.join(CVSRFL + pid) self.cvswfl = self.join(CVSWFL + pid) Index: Demo/pdist/rcslib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/pdist/rcslib.py,v retrieving revision 1.9 diff -u -r1.9 rcslib.py --- Demo/pdist/rcslib.py 9 Aug 2002 16:38:32 -0000 1.9 +++ Demo/pdist/rcslib.py 1 Dec 2003 22:48:40 -0000 @@ -232,7 +232,7 @@ """ name, rev = self._unmangle(name_rev) if not self.isvalid(name): - raise os.error, 'not an rcs file %s' % `name` + raise os.error, 'not an rcs file %r' % (name,) return name, rev # --- Internal methods --- @@ -252,7 +252,7 @@ namev = self.rcsname(name) if rev: cmd = cmd + ' ' + rflag + rev - return os.popen("%s %s" % (cmd, `namev`)) + return os.popen("%s %r" % (cmd, namev)) def _unmangle(self, name_rev): """INTERNAL: Normalize NAME_REV argument to (NAME, REV) tuple. Index: Demo/pdist/server.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/pdist/server.py,v retrieving revision 1.4 diff -u -r1.4 server.py --- Demo/pdist/server.py 21 Jun 1995 02:10:32 -0000 1.4 +++ Demo/pdist/server.py 1 Dec 2003 22:48:40 -0000 @@ -134,11 +134,11 @@ response = string.atol(string.strip(response)) except string.atol_error: if self._verbose > 0: - print "Invalid response syntax", `response` + print "Invalid response syntax", repr(response) return 0 if not self._compare_challenge_response(challenge, response): if self._verbose > 0: - print "Invalid response value", `response` + print "Invalid response value", repr(response) return 0 if self._verbose > 1: print "Response matches challenge. Go ahead!" Index: Demo/rpc/T.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/rpc/T.py,v retrieving revision 1.3 diff -u -r1.3 T.py --- Demo/rpc/T.py 17 Feb 1994 12:34:54 -0000 1.3 +++ Demo/rpc/T.py 1 Dec 2003 22:48:40 -0000 @@ -18,5 +18,5 @@ [u, s, r] = tt msg = '' for x in label: msg = msg + (x + ' ') - msg = msg + `u` + ' user, ' + `s` + ' sys, ' + `r` + ' real\n' + msg = msg + '%r user, %r sys, %r real\n' % (u, s, r) sys.stderr.write(msg) Index: Demo/rpc/rnusersclient.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/rpc/rnusersclient.py,v retrieving revision 1.3 diff -u -r1.3 rnusersclient.py --- Demo/rpc/rnusersclient.py 17 Dec 1993 14:32:26 -0000 1.3 +++ Demo/rpc/rnusersclient.py 1 Dec 2003 22:48:41 -0000 @@ -77,7 +77,7 @@ line = strip0(line) name = strip0(name) host = strip0(host) - print `name`, `host`, `line`, time, idle + print "%r %r %r %s %s" % (name, host, line, time, idle) def testbcast(): c = BroadcastRnusersClient('') Index: Demo/rpc/rpc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/rpc/rpc.py,v retrieving revision 1.11 diff -u -r1.11 rpc.py --- Demo/rpc/rpc.py 21 Jul 1996 02:09:54 -0000 1.11 +++ Demo/rpc/rpc.py 1 Dec 2003 22:48:41 -0000 @@ -93,10 +93,10 @@ xid = self.unpack_uint(xid) temp = self.unpack_enum() if temp <> CALL: - raise BadRPCFormat, 'no CALL but ' + `temp` + raise BadRPCFormat, 'no CALL but %r' % (temp,) temp = self.unpack_uint() if temp <> RPCVERSION: - raise BadRPCVerspion, 'bad RPC version ' + `temp` + raise BadRPCVerspion, 'bad RPC version %r' % (temp,) prog = self.unpack_uint() vers = self.unpack_uint() proc = self.unpack_uint() @@ -109,7 +109,7 @@ xid = self.unpack_uint() mtype = self.unpack_enum() if mtype <> REPLY: - raise RuntimeError, 'no REPLY but ' + `mtype` + raise RuntimeError, 'no REPLY but %r' % (mtype,) stat = self.unpack_enum() if stat == MSG_DENIED: stat = self.unpack_enum() @@ -117,15 +117,15 @@ low = self.unpack_uint() high = self.unpack_uint() raise RuntimeError, \ - 'MSG_DENIED: RPC_MISMATCH: ' + `low, high` + 'MSG_DENIED: RPC_MISMATCH: %r' % ((low, high),) if stat == AUTH_ERROR: stat = self.unpack_uint() raise RuntimeError, \ - 'MSG_DENIED: AUTH_ERROR: ' + `stat` - raise RuntimeError, 'MSG_DENIED: ' + `stat` + 'MSG_DENIED: AUTH_ERROR: %r' % (stat,) + raise RuntimeError, 'MSG_DENIED: %r' % (stat,) if stat <> MSG_ACCEPTED: raise RuntimeError, \ - 'Neither MSG_DENIED nor MSG_ACCEPTED: ' + `stat` + 'Neither MSG_DENIED nor MSG_ACCEPTED: %r' % (stat,) verf = self.unpack_auth() stat = self.unpack_enum() if stat == PROG_UNAVAIL: @@ -134,13 +134,13 @@ low = self.unpack_uint() high = self.unpack_uint() raise RuntimeError, \ - 'call failed: PROG_MISMATCH: ' + `low, high` + 'call failed: PROG_MISMATCH: %r' % ((low, high),) if stat == PROC_UNAVAIL: raise RuntimeError, 'call failed: PROC_UNAVAIL' if stat == GARBAGE_ARGS: raise RuntimeError, 'call failed: GARBAGE_ARGS' if stat <> SUCCESS: - raise RuntimeError, 'call failed: ' + `stat` + raise RuntimeError, 'call failed: %r' % (stat,) return xid, verf # Caller must get procedure-specific part of reply @@ -350,8 +350,8 @@ xid, verf = u.unpack_replyheader() if xid <> self.lastxid: # Can't really happen since this is TCP... - raise RuntimeError, 'wrong xid in reply ' + `xid` + \ - ' instead of ' + `self.lastxid` + raise RuntimeError, 'wrong xid in reply %r instead of %r' % ( + xid, self.lastxid) # Client using UDP to a specific port @@ -701,7 +701,7 @@ self.packer.pack_uint(self.vers) return self.packer.get_buf() proc = self.unpacker.unpack_uint() - methname = 'handle_' + `proc` + methname = 'handle_' + repr(proc) try: meth = getattr(self, methname) except AttributeError: @@ -840,7 +840,7 @@ bcastaddr = '' def rh(reply, fromaddr): host, port = fromaddr - print host + '\t' + `reply` + print host + '\t' + repr(reply) pmap = BroadcastUDPPortMapperClient(bcastaddr) pmap.set_reply_handler(rh) pmap.set_timeout(5) @@ -858,7 +858,7 @@ def handle_1(self): arg = self.unpacker.unpack_string() self.turn_around() - print 'RPC function 1 called, arg', `arg` + print 'RPC function 1 called, arg', repr(arg) self.packer.pack_string(arg + arg) # s = S('', 0x20000000, 1, 0) @@ -888,4 +888,4 @@ c = C(host, 0x20000000, 1) print 'making call...' reply = c.call_1('hello, world, ') - print 'call returned', `reply` + print 'call returned', repr(reply) Index: Demo/rpc/xdr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/rpc/xdr.py,v retrieving revision 1.10 diff -u -r1.10 xdr.py --- Demo/rpc/xdr.py 28 Jan 1998 14:59:48 -0000 1.10 +++ Demo/rpc/xdr.py 1 Dec 2003 22:48:41 -0000 @@ -184,8 +184,7 @@ x = self.unpack_uint() if x == 0: break if x <> 1: - raise RuntimeError, \ - '0 or 1 expected, got ' + `x` + raise RuntimeError, '0 or 1 expected, got %r' % (x, ) item = unpack_item() list.append(item) return list Index: Demo/scripts/eqfix.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/scripts/eqfix.py,v retrieving revision 1.7 diff -u -r1.7 eqfix.py --- Demo/scripts/eqfix.py 27 Nov 1996 19:46:46 -0000 1.7 +++ Demo/scripts/eqfix.py 1 Dec 2003 22:48:41 -0000 @@ -58,12 +58,12 @@ return ispythonprog.match(name) >= 0 def recursedown(dirname): - dbg('recursedown(' + `dirname` + ')\n') + dbg('recursedown(%r)\n' % (dirname,)) bad = 0 try: names = os.listdir(dirname) except os.error, msg: - err(dirname + ': cannot list directory: ' + `msg` + '\n') + err('%s: cannot list directory: %r\n' % (dirname, msg)) return 1 names.sort() subdirs = [] @@ -80,11 +80,11 @@ return bad def fix(filename): -## dbg('fix(' + `filename` + ')\n') +## dbg('fix(%r)\n' % (dirname,)) try: f = open(filename, 'r') except IOError, msg: - err(filename + ': cannot open: ' + `msg` + '\n') + err('%s: cannot open: %r\n' % (filename, msg)) return 1 head, tail = os.path.split(filename) tempname = os.path.join(head, '@' + tail) @@ -122,14 +122,13 @@ g = open(tempname, 'w') except IOError, msg: f.close() - err(tempname+': cannot create: '+\ - `msg`+'\n') + err('%s: cannot create: %r\n' % (tempname, msg)) return 1 f.seek(0) lineno = 0 rep(filename + ':\n') continue # restart from the beginning - rep(`lineno` + '\n') + rep(repr(lineno) + '\n') rep('< ' + line) rep('> ' + newline) if g is not None: @@ -146,17 +145,17 @@ statbuf = os.stat(filename) os.chmod(tempname, statbuf[ST_MODE] & 07777) except os.error, msg: - err(tempname + ': warning: chmod failed (' + `msg` + ')\n') + err('%s: warning: chmod failed (%r)\n' % (tempname, msg)) # Then make a backup of the original file as filename~ try: os.rename(filename, filename + '~') except os.error, msg: - err(filename + ': warning: backup failed (' + `msg` + ')\n') + err('%s: warning: backup failed (%r)\n' % (filename, msg)) # Now move the temp file to the original file try: os.rename(tempname, filename) except os.error, msg: - err(filename + ': rename failed (' + `msg` + ')\n') + err('%s: rename failed (%r)\n' % (filename, msg)) return 1 # Return succes return 0 Index: Demo/scripts/from.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/scripts/from.py,v retrieving revision 1.8 diff -u -r1.8 from.py --- Demo/scripts/from.py 20 Feb 2001 16:21:35 -0000 1.8 +++ Demo/scripts/from.py 1 Dec 2003 22:48:41 -0000 @@ -31,5 +31,5 @@ if not line or line == '\n': break if line.startswith('Subject: '): - print `line[9:-1]`, + print repr(line[9:-1]), print Index: Demo/scripts/ftpstats.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/scripts/ftpstats.py,v retrieving revision 1.3 diff -u -r1.3 ftpstats.py --- Demo/scripts/ftpstats.py 14 Sep 1998 16:44:00 -0000 1.3 +++ Demo/scripts/ftpstats.py 1 Dec 2003 22:48:41 -0000 @@ -60,7 +60,7 @@ if search and string.find(line, search) < 0: continue if prog.match(line) < 0: - print 'Bad line', lineno, ':', `line` + print 'Bad line', lineno, ':', repr(line) continue items = prog.group(1, 2, 3, 4, 5, 6) (logtime, loguser, loghost, logfile, logbytes, Index: Demo/scripts/lpwatch.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/scripts/lpwatch.py,v retrieving revision 1.7 diff -u -r1.7 lpwatch.py --- Demo/scripts/lpwatch.py 27 Nov 1996 19:46:53 -0000 1.7 +++ Demo/scripts/lpwatch.py 1 Dec 2003 22:48:41 -0000 @@ -83,24 +83,24 @@ lines.append(line) # if totaljobs: - line = `(totalbytes+1023)/1024` + ' K' + line = '%d K' % ((totalbytes+1023)/1024) if totaljobs <> len(users): - line = line + ' (' + `totaljobs` + ' jobs)' + line = line + ' (%d jobs)' % totaljobs if len(users) == 1: - line = line + ' for ' + users.keys()[0] + line = line + ' for %s' % (users.keys()[0],) else: - line = line + ' for ' + `len(users)` + ' users' + line = line + ' for %d users' % len(users) if userseen: if aheadjobs == 0: - line = line + ' (' + thisuser + ' first)' + line = line + ' (%s first)' % thisuser else: - line = line + ' (' + `(aheadbytes+1023)/1024` - line = line + ' K before ' + thisuser + ')' + line = line + ' (%d K before %s)' % ( + (aheadbytes+1023)/1024, thisuser) lines.append(line) # sts = pipe.close() if sts: - lines.append('lpq exit status ' + `sts`) + lines.append('lpq exit status %r' % (sts,)) return string.joinfields(lines, ': ') try: Index: Demo/scripts/markov.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/scripts/markov.py,v retrieving revision 1.3 diff -u -r1.3 markov.py --- Demo/scripts/markov.py 20 May 1998 17:11:46 -0000 1.3 +++ Demo/scripts/markov.py 1 Dec 2003 22:48:41 -0000 @@ -89,8 +89,8 @@ if debug > 1: for key in m.trans.keys(): if key is None or len(key) < histsize: - print `key`, m.trans[key] - if histsize == 0: print `''`, m.trans[''] + print repr(key), m.trans[key] + if histsize == 0: print repr(''), m.trans[''] print while 1: data = m.get() Index: Demo/scripts/mboxconvert.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/scripts/mboxconvert.py,v retrieving revision 1.4 diff -u -r1.4 mboxconvert.py --- Demo/scripts/mboxconvert.py 27 Nov 1996 19:46:57 -0000 1.4 +++ Demo/scripts/mboxconvert.py 1 Dec 2003 22:48:41 -0000 @@ -73,7 +73,7 @@ sts = message(f, line) or sts else: sys.stderr.write( - 'Bad line in MMFD mailbox: %s\n' % `line`) + 'Bad line in MMFD mailbox: %r\n' % (line,)) return sts counter = 0 # for generating unique Message-ID headers @@ -89,7 +89,7 @@ t = time.mktime(tt) else: sys.stderr.write( - 'Unparseable date: %s\n' % `m.getheader('Date')`) + 'Unparseable date: %r\n' % (m.getheader('Date'),)) t = os.fstat(f.fileno())[stat.ST_MTIME] print 'From', email, time.ctime(t) # Copy RFC822 header Index: Demo/scripts/mkrcs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/scripts/mkrcs.py,v retrieving revision 1.4 diff -u -r1.4 mkrcs.py --- Demo/scripts/mkrcs.py 27 Nov 1996 19:46:59 -0000 1.4 +++ Demo/scripts/mkrcs.py 1 Dec 2003 22:48:41 -0000 @@ -12,13 +12,13 @@ rcstree = 'RCStree' rcs = 'RCS' if os.path.islink(rcs): - print `rcs`, 'is a symlink to', `os.readlink(rcs)` + print '%r is a symlink to %r' % (rcs, os.readlink(rcs)) return if os.path.isdir(rcs): - print `rcs`, 'is an ordinary directory' + print '%r is an ordinary directory' % (rcs,) return if os.path.exists(rcs): - print `rcs`, 'is a file?!?!' + print '%r is a file?!?!' % (rcs,) return # p = os.getcwd() @@ -29,26 +29,26 @@ # (2) up is the same directory as p # Ergo: # (3) join(up, down) is the current directory - #print 'p =', `p` + #print 'p =', repr(p) while not os.path.isdir(os.path.join(p, rcstree)): head, tail = os.path.split(p) - #print 'head =', `head`, '; tail =', `tail` + #print 'head = %r; tail = %r' % (head, tail) if not tail: - print 'Sorry, no ancestor dir contains', `rcstree` + print 'Sorry, no ancestor dir contains %r' % (rcstree,) return p = head up = os.path.join(os.pardir, up) down = os.path.join(tail, down) - #print 'p =', `p`, '; up =', `up`, '; down =', `down` + #print 'p = %r; up = %r; down = %r' % (p, up, down) there = os.path.join(up, rcstree) there = os.path.join(there, down) there = os.path.join(there, rcs) if os.path.isdir(there): - print `there`, 'already exists' + print '%r already exists' % (there, ) else: - print 'making', `there` + print 'making %r' % (there,) makedirs(there) - print 'making symlink', `rcs`, '->', `there` + print 'making symlink %r -> %r' % (rcs, there) os.symlink(there, rcs) def makedirs(p): Index: Demo/scripts/mpzpi.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/scripts/mpzpi.py,v retrieving revision 1.2 diff -u -r1.2 mpzpi.py --- Demo/scripts/mpzpi.py 27 Nov 1996 19:47:00 -0000 1.2 +++ Demo/scripts/mpzpi.py 1 Dec 2003 22:48:41 -0000 @@ -27,7 +27,7 @@ def output(d): # Use write() to avoid spaces between the digits # Use int(d) to avoid a trailing L after each digit - sys.stdout.write(`int(d)`) + sys.stdout.write(repr(int(d))) # Flush so the output is seen immediately sys.stdout.flush() Index: Demo/scripts/newslist.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/scripts/newslist.py,v retrieving revision 1.10 diff -u -r1.10 newslist.py --- Demo/scripts/newslist.py 14 Sep 1998 16:44:01 -0000 1.10 +++ Demo/scripts/newslist.py 1 Dec 2003 22:48:42 -0000 @@ -304,7 +304,7 @@ def getnewgroups(server, treedate): print 'Getting list of new groups since start of '+treedate+'...', info = server.newgroups(treedate,'000001')[1] - print 'got '+`len(info)`+'.' + print 'got %d.' % len(info) print 'Processing...', groups = [] for i in info: Index: Demo/scripts/pp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/scripts/pp.py,v retrieving revision 1.5 diff -u -r1.5 pp.py --- Demo/scripts/pp.py 9 Aug 2002 16:38:32 -0000 1.5 +++ Demo/scripts/pp.py 1 Dec 2003 22:48:42 -0000 @@ -125,6 +125,6 @@ fp.flush() if DFLAG: import pdb - pdb.run('execfile(' + `tfn` + ')') + pdb.run('execfile(%r)' % (tfn,)) else: execfile(tfn) Index: Demo/sockets/broadcast.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/sockets/broadcast.py,v retrieving revision 1.4 diff -u -r1.4 broadcast.py --- Demo/sockets/broadcast.py 4 Mar 1995 22:57:55 -0000 1.4 +++ Demo/sockets/broadcast.py 1 Dec 2003 22:48:42 -0000 @@ -10,7 +10,7 @@ s.setsockopt(SOL_SOCKET, SO_BROADCAST, 1) while 1: - data = `time.time()` + '\n' + data = repr(time.time()) + '\n' s.sendto(data, ('', MYPORT)) time.sleep(2) Index: Demo/sockets/ftp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/sockets/ftp.py,v retrieving revision 1.5 diff -u -r1.5 ftp.py --- Demo/sockets/ftp.py 25 Aug 2000 15:38:41 -0000 1.5 +++ Demo/sockets/ftp.py 1 Dec 2003 22:48:42 -0000 @@ -91,7 +91,7 @@ hostname = gethostname() hostaddr = gethostbyname(hostname) hbytes = string.splitfields(hostaddr, '.') - pbytes = [`port/256`, `port%256`] + pbytes = [repr(port/256), repr(port%256)] bytes = hbytes + pbytes cmd = 'PORT ' + string.joinfields(bytes, ',') s.send(cmd + '\r\n') Index: Demo/sockets/gopher.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/sockets/gopher.py,v retrieving revision 1.4 diff -u -r1.4 gopher.py --- Demo/sockets/gopher.py 27 Nov 1996 19:50:41 -0000 1.4 +++ Demo/sockets/gopher.py 1 Dec 2003 22:48:42 -0000 @@ -75,10 +75,10 @@ typechar = line[0] parts = string.splitfields(line[1:], TAB) if len(parts) < 4: - print '(Bad line from server:', `line`, ')' + print '(Bad line from server: %r)' % (line,) continue if len(parts) > 4: - print '(Extra info from server:', parts[4:], ')' + print '(Extra info from server: %r)' % (parts[4:],) parts.insert(0, typechar) list.append(parts) f.close() @@ -154,17 +154,17 @@ list = get_menu(selector, host, port) while 1: print '----- MENU -----' - print 'Selector:', `selector` + print 'Selector:', repr(selector) print 'Host:', host, ' Port:', port print for i in range(len(list)): item = list[i] typechar, description = item[0], item[1] - print string.rjust(`i+1`, 3) + ':', description, + print string.rjust(repr(i+1), 3) + ':', description, if typename.has_key(typechar): print typename[typechar] else: - print '' + print '' print while 1: try: @@ -221,7 +221,7 @@ def browse_search(selector, host, port): while 1: print '----- SEARCH -----' - print 'Selector:', `selector` + print 'Selector:', repr(selector) print 'Host:', host, ' Port:', port print try: @@ -240,9 +240,9 @@ # "Browse" telnet-based information, i.e. open a telnet session def browse_telnet(selector, host, port): if selector: - print 'Log in as', `selector` + print 'Log in as', repr(selector) if type(port) <> type(''): - port = `port` + port = repr(port) sts = os.system('set -x; exec telnet ' + host + ' ' + port) if sts: print 'Exit status:', sts @@ -307,18 +307,18 @@ try: p = os.popen(cmd, 'w') except IOError, msg: - print `cmd`, ':', msg + print repr(cmd), ':', msg return None - print 'Piping through', `cmd`, '...' + print 'Piping through', repr(cmd), '...' return p if savefile[0] == '~': savefile = os.path.expanduser(savefile) try: f = open(savefile, 'w') except IOError, msg: - print `savefile`, ':', msg + print repr(savefile), ':', msg return None - print 'Saving to', `savefile`, '...' + print 'Saving to', repr(savefile), '...' return f # Test program Index: Demo/sockets/mcast.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/sockets/mcast.py,v retrieving revision 1.9 diff -u -r1.9 mcast.py --- Demo/sockets/mcast.py 7 Aug 1999 14:01:05 -0000 1.9 +++ Demo/sockets/mcast.py 1 Dec 2003 22:48:42 -0000 @@ -38,7 +38,7 @@ ttl = struct.pack('b', 1) # Time-to-live s.setsockopt(IPPROTO_IP, IP_MULTICAST_TTL, ttl) while 1: - data = `time.time()` + data = repr(time.time()) ## data = data + (1400 - len(data)) * '\0' s.sendto(data, (mygroup, MYPORT)) time.sleep(1) @@ -53,7 +53,7 @@ while 1: data, sender = s.recvfrom(1500) while data[-1:] == '\0': data = data[:-1] # Strip trailing \0's - print sender, ':', `data` + print sender, ':', repr(data) # Open a UDP socket, bind it to a port and select a multicast group Index: Demo/sockets/radio.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/sockets/radio.py,v retrieving revision 1.3 diff -u -r1.3 radio.py --- Demo/sockets/radio.py 8 Oct 1994 19:13:48 -0000 1.3 +++ Demo/sockets/radio.py 1 Dec 2003 22:48:42 -0000 @@ -10,5 +10,5 @@ while 1: data, wherefrom = s.recvfrom(1500, 0) - sys.stderr.write(`wherefrom` + '\n') + sys.stderr.write(repr(wherefrom) + '\n') sys.stdout.write(data) Index: Demo/sockets/telnet.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/sockets/telnet.py,v retrieving revision 1.5 diff -u -r1.5 telnet.py --- Demo/sockets/telnet.py 25 Aug 2000 15:38:41 -0000 1.5 +++ Demo/sockets/telnet.py 1 Dec 2003 22:48:42 -0000 @@ -53,7 +53,7 @@ try: s.connect((host, port)) except error, msg: - sys.stderr.write('connect failed: ' + `msg` + '\n') + sys.stderr.write('connect failed: ' + repr(msg) + '\n') sys.exit(1) # pid = posix.fork() Index: Demo/sockets/udpecho.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/sockets/udpecho.py,v retrieving revision 1.5 diff -u -r1.5 udpecho.py --- Demo/sockets/udpecho.py 25 Aug 2000 15:38:41 -0000 1.5 +++ Demo/sockets/udpecho.py 1 Dec 2003 22:48:42 -0000 @@ -37,7 +37,7 @@ print 'udp echo server ready' while 1: data, addr = s.recvfrom(BUFSIZE) - print 'server received', `data`, 'from', `addr` + print 'server received %r from %r' % (data, addr) s.sendto(data, addr) def client(): @@ -58,6 +58,6 @@ break s.sendto(line, addr) data, fromaddr = s.recvfrom(BUFSIZE) - print 'client received', `data`, 'from', `fromaddr` + print 'client received %r from %r' % (data, fromaddr) main() Index: Demo/sockets/unicast.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/sockets/unicast.py,v retrieving revision 1.1 diff -u -r1.1 unicast.py --- Demo/sockets/unicast.py 21 Aug 1996 20:11:55 -0000 1.1 +++ Demo/sockets/unicast.py 1 Dec 2003 22:48:42 -0000 @@ -9,7 +9,7 @@ s.bind(('', 0)) while 1: - data = `time.time()` + '\n' + data = repr(time.time()) + '\n' s.sendto(data, ('', MYPORT)) time.sleep(2) Index: Demo/sockets/unixclient.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/sockets/unixclient.py,v retrieving revision 1.1 diff -u -r1.1 unixclient.py --- Demo/sockets/unixclient.py 28 Jan 1998 16:53:57 -0000 1.1 +++ Demo/sockets/unixclient.py 1 Dec 2003 22:48:42 -0000 @@ -7,4 +7,4 @@ s.send('Hello, world') data = s.recv(1024) s.close() -print 'Received', `data` +print 'Received', repr(data) Index: Demo/threads/Coroutine.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/threads/Coroutine.py,v retrieving revision 1.1 diff -u -r1.1 Coroutine.py --- Demo/threads/Coroutine.py 8 Nov 2000 15:17:49 -0000 1.1 +++ Demo/threads/Coroutine.py 1 Dec 2003 22:48:42 -0000 @@ -138,10 +138,9 @@ def tran(self, target, data=None): if not self.invokedby.has_key(target): - raise TypeError, '.tran target ' + `target` + \ - ' is not an active coroutine' + raise TypeError, '.tran target %r is not an active coroutine' % (target,) if self.killed: - raise TypeError, '.tran target ' + `target` + ' is killed' + raise TypeError, '.tran target %r is killed' % (target,) self.value = data me = self.active self.invokedby[target] = me @@ -153,7 +152,7 @@ if self.main is not me: raise Killed if self.terminated_by is not None: - raise EarlyExit, `self.terminated_by` + ' terminated early' + raise EarlyExit, '%r terminated early' % (self.terminated_by,) return self.value Index: Demo/threads/find.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/threads/find.py,v retrieving revision 1.7 diff -u -r1.7 find.py --- Demo/threads/find.py 18 Oct 2002 18:20:33 -0000 1.7 +++ Demo/threads/find.py 1 Dec 2003 22:48:42 -0000 @@ -116,7 +116,7 @@ wq.run(nworkers) t2 = time.time() - sys.stderr.write('Total time ' + `t2-t1` + ' sec.\n') + sys.stderr.write('Total time %r sec.\n' % (t2-t1)) # The predicate -- defines what files we look for. @@ -133,7 +133,7 @@ try: names = os.listdir(dir) except os.error, msg: - print `dir`, ':', msg + print repr(dir), ':', msg return for name in names: if name not in (os.curdir, os.pardir): @@ -141,7 +141,7 @@ try: stat = os.lstat(fullname) except os.error, msg: - print `fullname`, ':', msg + print repr(fullname), ':', msg continue if pred(dir, name, fullname, stat): print fullname Index: Demo/threads/sync.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/threads/sync.py,v retrieving revision 1.6 diff -u -r1.6 sync.py --- Demo/threads/sync.py 14 Sep 1998 16:44:07 -0000 1.6 +++ Demo/threads/sync.py 1 Dec 2003 22:48:43 -0000 @@ -336,7 +336,7 @@ def broadcast(self, num = -1): if num < -1: - raise ValueError, '.broadcast called with num ' + `num` + raise ValueError, '.broadcast called with num %r' % (num,) if num == 0: return self.idlock.acquire() @@ -418,7 +418,7 @@ self.nonzero.acquire() if self.count == self.maxcount: raise ValueError, '.v() tried to raise semaphore count above ' \ - 'initial value ' + `maxcount` + 'initial value %r' % (maxcount,)) self.count = self.count + 1 self.nonzero.signal() self.nonzero.release() Index: Demo/threads/telnet.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/threads/telnet.py,v retrieving revision 1.5 diff -u -r1.5 telnet.py --- Demo/threads/telnet.py 21 Jan 2001 07:07:30 -0000 1.5 +++ Demo/threads/telnet.py 1 Dec 2003 22:48:43 -0000 @@ -57,7 +57,7 @@ try: s.connect((host, port)) except error, msg: - sys.stderr.write('connect failed: ' + `msg` + '\n') + sys.stderr.write('connect failed: %r\n' % (msg,)) sys.exit(1) # thread.start_new(child, (s,)) @@ -77,7 +77,7 @@ for c in data: if opt: print ord(c) -## print '(replying: ' + `opt+c` + ')' +## print '(replying: %r)' % (opt+c,) s.send(opt + c) opt = '' elif iac: @@ -101,13 +101,13 @@ cleandata = cleandata + c sys.stdout.write(cleandata) sys.stdout.flush() -## print 'Out:', `cleandata` +## print 'Out:', repr(cleandata) def child(s): # read stdin, write socket while 1: line = sys.stdin.readline() -## print 'Got:', `line` +## print 'Got:', repr(line) if not line: break s.send(line) Index: Demo/tix/samples/DirList.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/tix/samples/DirList.py,v retrieving revision 1.2 diff -u -r1.2 DirList.py --- Demo/tix/samples/DirList.py 17 Mar 2002 18:19:13 -0000 1.2 +++ Demo/tix/samples/DirList.py 1 Dec 2003 22:48:44 -0000 @@ -75,7 +75,7 @@ top.btn['command'] = lambda dir=top.dir, ent=top.ent, self=self: \ self.copy_name(dir,ent) - # top.ent.entry.insert(0,'tix'+`self`) + # top.ent.entry.insert(0,'tix'+repr(self)) top.ent.entry.bind('', lambda self=self: self.okcmd () ) top.pack( expand='yes', fill='both', side=TOP) Index: Demo/tkinter/guido/mbox.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/tkinter/guido/mbox.py,v retrieving revision 1.4 diff -u -r1.4 mbox.py --- Demo/tkinter/guido/mbox.py 27 Nov 1996 19:51:29 -0000 1.4 +++ Demo/tkinter/guido/mbox.py 1 Dec 2003 22:48:44 -0000 @@ -253,7 +253,7 @@ def fixfocus(near, itop): n = scanbox.size() for i in range(n): - line = scanbox.get(`i`) + line = scanbox.get(repr(i)) if scanparser.match(line) >= 0: num = string.atoi(scanparser.group(1)) if num >= near: Index: Demo/tkinter/guido/solitaire.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/tkinter/guido/solitaire.py,v retrieving revision 1.4 diff -u -r1.4 solitaire.py --- Demo/tkinter/guido/solitaire.py 30 Dec 1996 16:45:14 -0000 1.4 +++ Demo/tkinter/guido/solitaire.py 1 Dec 2003 22:48:45 -0000 @@ -183,7 +183,7 @@ def __repr__(self): """Return a string for debug print statements.""" - return "Card(%s, %s)" % (`self.suit`, `self.value`) + return "Card(%r, %r)" % (self.suit, self.value) def moveto(self, x, y): """Move the card to absolute position (x, y).""" Index: Demo/tkinter/matt/animation-w-velocity-ctrl.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/tkinter/matt/animation-w-velocity-ctrl.py,v retrieving revision 1.2 diff -u -r1.2 animation-w-velocity-ctrl.py --- Demo/tkinter/matt/animation-w-velocity-ctrl.py 30 Jul 1996 18:56:31 -0000 1.2 +++ Demo/tkinter/matt/animation-w-velocity-ctrl.py 1 Dec 2003 22:48:45 -0000 @@ -28,7 +28,7 @@ def moveThing(self, *args): velocity = self.speed.get() str = float(velocity) / 1000.0 - str = `str` + "i" + str = "%ri" % (str,) self.draw.move("thing", str, str) self.after(10, self.moveThing) Index: Demo/tkinter/matt/pong-demo-1.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/tkinter/matt/pong-demo-1.py,v retrieving revision 1.2 diff -u -r1.2 pong-demo-1.py --- Demo/tkinter/matt/pong-demo-1.py 30 Jul 1996 18:57:03 -0000 1.2 +++ Demo/tkinter/matt/pong-demo-1.py 1 Dec 2003 22:48:46 -0000 @@ -39,7 +39,7 @@ self.x = self.x + deltax self.y = self.y + deltay - self.draw.move(self.ball, `deltax` + "i", `deltay` + "i") + self.draw.move(self.ball, "%ri" % deltax, "%ri" % deltay) self.after(10, self.moveBall) def __init__(self, master=None): Index: Doc/lib/caseless.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/caseless.py,v retrieving revision 1.1 diff -u -r1.1 caseless.py --- Doc/lib/caseless.py 6 Jan 2003 16:51:33 -0000 1.1 +++ Doc/lib/caseless.py 1 Dec 2003 22:49:01 -0000 @@ -47,10 +47,10 @@ print "not ok: no conflict between -h and -H" parser.add_option("-f", "--file", dest="file") - #print `parser.get_option("-f")` - #print `parser.get_option("-F")` - #print `parser.get_option("--file")` - #print `parser.get_option("--fIlE")` + #print repr(parser.get_option("-f")) + #print repr(parser.get_option("-F")) + #print repr(parser.get_option("--file")) + #print repr(parser.get_option("--fIlE")) (options, args) = parser.parse_args(["--FiLe", "foo"]) assert options.file == "foo", options.file print "ok: case insensitive long options work" Index: Doc/tools/cvsinfo.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/cvsinfo.py,v retrieving revision 1.1 diff -u -r1.1 cvsinfo.py --- Doc/tools/cvsinfo.py 6 Oct 2000 16:36:48 -0000 1.1 +++ Doc/tools/cvsinfo.py 1 Dec 2003 22:49:46 -0000 @@ -78,4 +78,4 @@ return fn[len(self.cvsroot_path)+1:] def __repr__(self): - return "" % `self.get_cvsroot()` + return "" % self.get_cvsroot() Index: Doc/tools/refcounts.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/refcounts.py,v retrieving revision 1.4 diff -u -r1.4 refcounts.py --- Doc/tools/refcounts.py 16 Oct 2002 15:27:02 -0000 1.4 +++ Doc/tools/refcounts.py 1 Dec 2003 22:49:49 -0000 @@ -32,7 +32,7 @@ continue parts = line.split(":", 4) if len(parts) != 5: - raise ValueError("Not enough fields in " + `line`) + raise ValueError("Not enough fields in %r" % line) function, type, arg, refcount, comment = parts if refcount == "null": refcount = None Index: Doc/tools/sgmlconv/esistools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/sgmlconv/esistools.py,v retrieving revision 1.9 diff -u -r1.9 esistools.py --- Doc/tools/sgmlconv/esistools.py 16 Oct 2002 16:02:08 -0000 1.9 +++ Doc/tools/sgmlconv/esistools.py 1 Dec 2003 22:49:50 -0000 @@ -29,7 +29,7 @@ n, s = s.split(";", 1) r = r + unichr(int(n)) else: - raise ValueError, "can't handle " + `s` + raise ValueError, "can't handle %r" % s return r @@ -220,8 +220,8 @@ return self._decl_handler else: - raise xml.sax.SAXNotRecognizedException("unknown property %s" - % `property`) + raise xml.sax.SAXNotRecognizedException("unknown property %r" + % (property, )) def setProperty(self, property, value): if property == xml.sax.handler.property_lexical_handler: Index: Doc/tools/sgmlconv/latex2esis.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/sgmlconv/latex2esis.py,v retrieving revision 1.31 diff -u -r1.31 latex2esis.py --- Doc/tools/sgmlconv/latex2esis.py 16 Oct 2002 16:00:42 -0000 1.31 +++ Doc/tools/sgmlconv/latex2esis.py 1 Dec 2003 22:49:51 -0000 @@ -73,8 +73,8 @@ class _Stack(list): def append(self, entry): if not isinstance(entry, str): - raise LaTeXFormatError("cannot push non-string on stack: " - + `entry`) + raise LaTeXFormatError("cannot push non-string on stack: %r" + % (entry, )) #dbgmsg("%s<%s>" % (" "*len(self.data), entry)) list.append(self, entry) @@ -208,8 +208,8 @@ m = _parameter_rx.match(line) if not m: raise LaTeXFormatError( - "could not extract parameter %s for %s: %s" - % (pentry.name, macroname, `line[:100]`)) + "could not extract parameter %s for %s: %r" + % (pentry.name, macroname, line[:100])) if entry.outputname: self.dump_attr(pentry, m.group(1)) line = line[m.end():] @@ -259,7 +259,7 @@ opened = 1 stack.append(entry.name) self.write("(%s\n" % entry.outputname) - #dbgmsg("--- text: %s" % `pentry.text`) + #dbgmsg("--- text: %r" % pentry.text) self.write("-%s\n" % encode(pentry.text)) elif pentry.type == "entityref": self.write("&%s\n" % pentry.name) @@ -326,8 +326,8 @@ extra = "" if len(line) > 100: extra = "..." - raise LaTeXFormatError("could not identify markup: %s%s" - % (`line[:100]`, extra)) + raise LaTeXFormatError("could not identify markup: %r%s" + % (line[:100], extra)) while stack: entry = self.get_entry(stack[-1]) if entry.closes: @@ -361,7 +361,7 @@ def get_entry(self, name): entry = self.table.get(name) if entry is None: - dbgmsg("get_entry(%s) failing; building default entry!" % `name`) + dbgmsg("get_entry(%r) failing; building default entry!" % (name, )) # not defined; build a default entry: entry = TableEntry(name) entry.has_content = 1 @@ -486,7 +486,7 @@ def end_macro(self): name = self.__current.name if self.__table.has_key(name): - raise ValueError("name %s already in use" % `name`) + raise ValueError("name %r already in use" % (name,)) self.__table[name] = self.__current self.__current = None Index: Lib/BaseHTTPServer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/BaseHTTPServer.py,v retrieving revision 1.28 diff -u -r1.28 BaseHTTPServer.py --- Lib/BaseHTTPServer.py 9 Aug 2003 05:01:41 -0000 1.28 +++ Lib/BaseHTTPServer.py 1 Dec 2003 22:50:01 -0000 @@ -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() Index: Lib/Bastion.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/Bastion.py,v retrieving revision 1.7 diff -u -r1.7 Bastion.py --- Lib/Bastion.py 6 Jan 2003 15:43:34 -0000 1.7 +++ Lib/Bastion.py 1 Dec 2003 22:50:01 -0000 @@ -124,7 +124,7 @@ return get1(name) if name is None: - name = `object` + name = repr(object) return bastionclass(get2, name) Index: Lib/CGIHTTPServer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/CGIHTTPServer.py,v retrieving revision 1.32 diff -u -r1.32 CGIHTTPServer.py --- Lib/CGIHTTPServer.py 14 Jul 2003 06:56:32 -0000 1.32 +++ Lib/CGIHTTPServer.py 1 Dec 2003 22:50:01 -0000 @@ -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 Index: Lib/ConfigParser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/ConfigParser.py,v retrieving revision 1.61 diff -u -r1.61 ConfigParser.py --- Lib/ConfigParser.py 21 Oct 2003 16:45:00 -0000 1.61 +++ Lib/ConfigParser.py 1 Dec 2003 22:50:02 -0000 @@ -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,)) Index: Lib/HTMLParser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/HTMLParser.py,v retrieving revision 1.12 diff -u -r1.12 HTMLParser.py --- Lib/HTMLParser.py 14 Mar 2003 16:21:54 -0000 1.12 +++ Lib/HTMLParser.py 1 Dec 2003 22:50:02 -0000 @@ -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: self.handle_startendtag(tag, attrs) @@ -324,7 +324,7 @@ j = match.end() match = endtagfind.match(rawdata, i) # 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): Index: Lib/StringIO.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/StringIO.py,v retrieving revision 1.30 diff -u -r1.30 StringIO.py --- Lib/StringIO.py 18 Oct 2003 10:20:42 -0000 1.30 +++ Lib/StringIO.py 1 Dec 2003 22:50:02 -0000 @@ -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: Index: Lib/aifc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/aifc.py,v retrieving revision 1.42 diff -u -r1.42 aifc.py --- Lib/aifc.py 12 Aug 2002 22:11:28 -0000 1.42 +++ Lib/aifc.py 1 Dec 2003 22:50:03 -0000 @@ -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: Index: Lib/atexit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/atexit.py,v retrieving revision 1.6 diff -u -r1.6 atexit.py --- Lib/atexit.py 27 Feb 2003 20:14:31 -0000 1.6 +++ Lib/atexit.py 1 Dec 2003 22:50:04 -0000 @@ -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) Index: Lib/base64.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/base64.py,v retrieving revision 1.13 diff -u -r1.13 base64.py --- Lib/base64.py 4 Sep 2001 19:14:13 -0000 1.13 +++ Lib/base64.py 1 Dec 2003 22:50:04 -0000 @@ -71,7 +71,7 @@ s0 = "Aladdin:open sesame" s1 = encodestring(s0) s2 = decodestring(s1) - print s0, `s1`, s2 + print s0, repr(s1), s2 if __name__ == '__main__': test() Index: Lib/bdb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bdb.py,v retrieving revision 1.42 diff -u -r1.42 bdb.py --- Lib/bdb.py 27 Feb 2003 20:14:32 -0000 1.42 +++ Lib/bdb.py 1 Dec 2003 22:50:05 -0000 @@ -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: Index: Lib/binhex.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/binhex.py,v retrieving revision 1.22 diff -u -r1.22 binhex.py --- Lib/binhex.py 4 Sep 2001 19:14:13 -0000 1.22 +++ Lib/binhex.py 1 Dec 2003 22:50:05 -0000 @@ -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 Index: Lib/calendar.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/calendar.py,v retrieving revision 1.32 diff -u -r1.32 calendar.py --- Lib/calendar.py 13 Feb 2003 22:58:02 -0000 1.32 +++ Lib/calendar.py 1 Dec 2003 22:50:05 -0000 @@ -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): Index: Lib/cgi.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/cgi.py,v retrieving revision 1.76 diff -u -r1.76 cgi.py --- Lib/cgi.py 27 Feb 2003 20:14:32 -0000 1.76 +++ Lib/cgi.py 1 Dec 2003 22:50:06 -0000 @@ -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 "
" + escape(key) + ":", value = form[key] - print "" + escape(`type(value)`) + "" - print "
" + escape(`value`) + print "" + escape(repr(type(value))) + "" + print "
" + escape(repr(value)) print "" print Index: Lib/difflib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/difflib.py,v retrieving revision 1.17 diff -u -r1.17 difflib.py --- Lib/difflib.py 16 Oct 2003 05:53:16 -0000 1.17 +++ Lib/difflib.py 1 Dec 2003 22:50:11 -0000 @@ -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: Index: Lib/dis.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/dis.py,v retrieving revision 1.47 diff -u -r1.47 dis.py --- Lib/dis.py 28 Oct 2003 12:17:25 -0000 1.47 +++ Lib/dis.py 1 Dec 2003 22:50:12 -0000 @@ -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] + ')', Index: Lib/doctest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/doctest.py,v retrieving revision 1.32 diff -u -r1.32 doctest.py --- Lib/doctest.py 17 Sep 2003 05:50:59 -0000 1.32 +++ Lib/doctest.py 1 Dec 2003 22:50:14 -0000 @@ -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 Index: Lib/formatter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/formatter.py,v retrieving revision 1.23 diff -u -r1.23 formatter.py --- Lib/formatter.py 27 Feb 2003 20:14:33 -0000 1.23 +++ Lib/formatter.py 1 Dec 2003 22:50:15 -0000 @@ -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): Index: Lib/fpformat.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/fpformat.py,v retrieving revision 1.9 diff -u -r1.9 fpformat.py --- Lib/fpformat.py 20 Jan 2001 23:34:12 -0000 1.9 +++ Lib/fpformat.py 1 Dec 2003 22:50:16 -0000 @@ -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 Index: Lib/ftplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/ftplib.py,v retrieving revision 1.72 diff -u -r1.72 ftplib.py --- Lib/ftplib.py 3 Jun 2002 10:41:45 -0000 1.72 +++ Lib/ftplib.py 1 Dec 2003 22:50:17 -0000 @@ -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: Index: Lib/gopherlib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/gopherlib.py,v retrieving revision 1.13 diff -u -r1.13 gopherlib.py --- Lib/gopherlib.py 22 Sep 2003 12:43:16 -0000 1.13 +++ Lib/gopherlib.py 1 Dec 2003 22:50:18 -0000 @@ -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__': Index: Lib/gzip.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/gzip.py,v retrieving revision 1.38 diff -u -r1.38 gzip.py --- Lib/gzip.py 5 Feb 2003 21:35:07 -0000 1.38 +++ Lib/gzip.py 1 Dec 2003 22:50:18 -0000 @@ -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") Index: Lib/ihooks.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/ihooks.py,v retrieving revision 1.17 diff -u -r1.17 ihooks.py --- Lib/ihooks.py 20 Oct 2003 14:01:49 -0000 1.17 +++ Lib/ihooks.py 1 Dec 2003 22:50:19 -0000 @@ -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 Index: Lib/imaplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/imaplib.py,v retrieving revision 1.65 diff -u -r1.65 imaplib.py --- Lib/imaplib.py 10 Nov 2003 06:44:44 -0000 1.65 +++ Lib/imaplib.py 1 Dec 2003 22:50:20 -0000 @@ -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) Index: Lib/macurl2path.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/macurl2path.py,v retrieving revision 1.11 diff -u -r1.11 macurl2path.py --- Lib/macurl2path.py 9 Feb 2001 09:48:45 -0000 1.11 +++ Lib/macurl2path.py 1 Dec 2003 22:50:21 -0000 @@ -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() Index: Lib/markupbase.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/markupbase.py,v retrieving revision 1.8 diff -u -r1.8 markupbase.py --- Lib/markupbase.py 24 Apr 2003 16:02:42 -0000 1.8 +++ Lib/markupbase.py 1 Dec 2003 22:50:22 -0000 @@ -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 != "/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()') Index: Lib/mimetools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/mimetools.py,v retrieving revision 1.29 diff -u -r1.29 mimetools.py --- Lib/mimetools.py 15 Jun 2003 22:12:23 -0000 1.29 +++ Lib/mimetools.py 1 Dec 2003 22:50:22 -0000 @@ -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 Index: Lib/modulefinder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/modulefinder.py,v retrieving revision 1.8 diff -u -r1.8 modulefinder.py --- Lib/modulefinder.py 14 Nov 2003 10:28:42 -0000 1.8 +++ Lib/modulefinder.py 1 Dec 2003 22:50:23 -0000 @@ -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) Index: Lib/nntplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/nntplib.py,v retrieving revision 1.36 diff -u -r1.36 nntplib.py --- Lib/nntplib.py 19 Apr 2003 18:04:57 -0000 1.36 +++ Lib/nntplib.py 1 Dec 2003 22:50:25 -0000 @@ -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) Index: Lib/opcode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/opcode.py,v retrieving revision 1.3 diff -u -r1.3 opcode.py --- Lib/opcode.py 24 Apr 2003 05:45:17 -0000 1.3 +++ Lib/opcode.py 1 Dec 2003 22:50:25 -0000 @@ -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): Index: Lib/pdb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pdb.py,v retrieving revision 1.66 diff -u -r1.66 pdb.py --- Lib/pdb.py 15 Jun 2003 23:26:29 -0000 1.66 +++ Lib/pdb.py 1 Dec 2003 22:50:27 -0000 @@ -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,)) Index: Lib/pickle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pickle.py,v retrieving revision 1.156 diff -u -r1.156 pickle.py --- Lib/pickle.py 29 Jun 2003 16:59:59 -0000 1.156 +++ Lib/pickle.py 1 Dec 2003 22:50:28 -0000 @@ -261,7 +261,7 @@ else: return LONG_BINPUT + 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("' + """t.__repr__() implements repr(t).""" + return '