diff options
author | Guido van Rossum <guido@python.org> | 1992-01-01 19:35:13 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1992-01-01 19:35:13 (GMT) |
commit | bdfcfccbe591e15221f35add01132174c9b4e669 (patch) | |
tree | 7e5f0d52b8c44e623b12e8f4b5cd645c361e5aeb /Lib/lib-old/tb.py | |
parent | 4d8e859e8f0a209a7e999ce9cc0988156c795949 (diff) | |
download | cpython-bdfcfccbe591e15221f35add01132174c9b4e669.zip cpython-bdfcfccbe591e15221f35add01132174c9b4e669.tar.gz cpython-bdfcfccbe591e15221f35add01132174c9b4e669.tar.bz2 |
New == syntax
Diffstat (limited to 'Lib/lib-old/tb.py')
-rw-r--r-- | Lib/lib-old/tb.py | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/Lib/lib-old/tb.py b/Lib/lib-old/tb.py index ec63104..ef0c4b5 100644 --- a/Lib/lib-old/tb.py +++ b/Lib/lib-old/tb.py @@ -40,19 +40,19 @@ def browser(tb): break cmd = string.strip(line) if cmd: - if cmd = 'quit': + if cmd == 'quit': break - elif cmd = 'list': + elif cmd == 'list': browserlist(tb) - elif cmd = 'up': + elif cmd == 'up': if ptr-1 >= 0: ptr = ptr-1 else: print 'Bottom of stack.' - elif cmd = 'down': + elif cmd == 'down': if ptr+1 < len(tblist): ptr = ptr+1 else: print 'Top of stack.' - elif cmd = 'locals': + elif cmd == 'locals': printsymbols(tb.tb_frame.f_locals) - elif cmd = 'globals': + elif cmd == 'globals': printsymbols(tb.tb_frame.f_globals) elif cmd in ('?', 'help'): browserhelp() @@ -65,10 +65,10 @@ def browserlist(tb): last = lineno first = max(1, last-10) for i in range(first, last+1): - if i = lineno: prefix = '***' + string.rjust(`i`, 4) + ':' + if i == lineno: prefix = '***' + string.rjust(`i`, 4) + ':' else: prefix = string.rjust(`i`, 7) + ':' line = readfileline(filename, i) - if line[-1:] = '\n': line = line[:-1] + if line[-1:] == '\n': line = line[:-1] print prefix + line def browserexec(tb, cmd): @@ -126,24 +126,24 @@ def printsymbols(d): print def printobject(v, maxlevel): - if v = None: + if v == None: print 'None', elif type(v) in (type(0), type(0.0)): print v, - elif type(v) = type(''): + elif type(v) == type(''): if len(v) > 20: print `v[:17] + '...'`, else: print `v`, - elif type(v) = type(()): + elif type(v) == type(()): print '(', printlist(v, maxlevel) print ')', - elif type(v) = type([]): + elif type(v) == type([]): print '[', printlist(v, maxlevel) print ']', - elif type(v) = type({}): + elif type(v) == type({}): print '{', printdict(v, maxlevel) print '}', @@ -152,7 +152,7 @@ def printobject(v, maxlevel): def printlist(v, maxlevel): n = len(v) - if n = 0: return + if n == 0: return if maxlevel <= 0: print '...', return @@ -164,7 +164,7 @@ def printlist(v, maxlevel): def printdict(v, maxlevel): keys = v.keys() n = len(keys) - if n = 0: return + if n == 0: return if maxlevel <= 0: print '...', return @@ -187,8 +187,8 @@ def readfileline(filename, lineno): cache_ok = 0 if _filecache.has_key(filename): cached_stat, lines = _filecache[filename] - if stat[ST_SIZE] = cached_stat[ST_SIZE] and \ - stat[ST_MTIME] = cached_stat[ST_MTIME]: + if stat[ST_SIZE] == cached_stat[ST_SIZE] and \ + stat[ST_MTIME] == cached_stat[ST_MTIME]: cache_ok = 1 else: print 'Stale cache entry for', filename |