]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
New == syntax
authorGuido van Rossum <guido@python.org>
Wed, 1 Jan 1992 19:35:13 +0000 (19:35 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 1 Jan 1992 19:35:13 +0000 (19:35 +0000)
73 files changed:
Demo/scripts/fact.py
Demo/scripts/from.py
Demo/scripts/lpwatch.py
Demo/scripts/pi.py
Demo/scripts/primes.py
Lib/calendar.py
Lib/cmp.py
Lib/cmpcache.py
Lib/commands.py
Lib/dircmp.py
Lib/dis.py
Lib/dump.py
Lib/fnmatch.py
Lib/getopt.py
Lib/glob.py
Lib/grep.py
Lib/irix5/auds.py
Lib/irix5/flp.py
Lib/irix5/panel.py
Lib/irix5/panelparser.py
Lib/lib-old/dump.py
Lib/lib-old/grep.py
Lib/lib-old/newdir.py
Lib/lib-old/tb.py
Lib/lib-stdwin/Buttons.py
Lib/lib-stdwin/CSplit.py
Lib/lib-stdwin/DirList.py
Lib/lib-stdwin/Split.py
Lib/lib-stdwin/StripChart.py
Lib/lib-stdwin/WindowParent.py
Lib/lib-stdwin/WindowSched.py
Lib/lib-stdwin/dirwin.py
Lib/lib-stdwin/formatter.py
Lib/lib-stdwin/gwin.py
Lib/lib-stdwin/tablewin.py
Lib/macpath.py
Lib/newdir.py
Lib/persist.py
Lib/plat-irix5/flp.py
Lib/plat-irix5/panel.py
Lib/plat-irix5/panelparser.py
Lib/poly.py
Lib/posixpath.py
Lib/sched.py
Lib/stat.py
Lib/statcache.py
Lib/stdwin/Buttons.py
Lib/stdwin/CSplit.py
Lib/stdwin/DirList.py
Lib/stdwin/Split.py
Lib/stdwin/StripChart.py
Lib/stdwin/WindowParent.py
Lib/stdwin/WindowSched.py
Lib/stdwin/dirwin.py
Lib/stdwin/formatter.py
Lib/stdwin/gwin.py
Lib/stdwin/tablewin.py
Lib/string.py
Lib/stringold.py
Lib/sunaudio.py
Lib/tb.py
Lib/test/testall.py
Lib/zmod.py
Mac/Lib/maccache.py
Tools/scripts/byteyears.py
Tools/scripts/checkpyc.py
Tools/scripts/findlinksto.py
Tools/scripts/objgraph.py
Tools/scripts/pdeps.py
Tools/scripts/ptags.py
Tools/scripts/suff.py
Tools/scripts/which.py
Tools/scripts/xxci.py

index 6aac414ac48a19b573af9f0aa65516566481c0c4..b406086819d066573a728e942d94dea3ea04c3f6 100755 (executable)
@@ -12,17 +12,17 @@ error = 'fact.error'                # exception
 
 def fact(n):
        if n < 1: raise error   # fact() argument should be >= 1
-       if n = 1: return []     # special case
+       if n == 1: return []    # special case
        res = []
        # Treat even factors special, so we can use i = i+2 later
-       while n%2 = 0:
+       while n%2 == 0:
                res.append(2)
                n = n/2
        # Try odd numbers up to sqrt(n)
        limit = sqrt(n+1)
        i = 3
        while i <= limit:
-               if n%i = 0:
+               if n%i == 0:
                        res.append(i)
                        n = n/i
                        limit = sqrt(n+1)
index 21ca081669ef92f56e7b5cf3cad58ec4af98f6f0..8e663f16e158c9794abd96606080826981e789c6 100755 (executable)
@@ -24,13 +24,13 @@ except RuntimeError:
 while 1:
        line = mail.readline()
        if not line: break # EOF
-       if line[:5] = 'From ':
+       if line[:5] == 'From ':
                # Start of message found
                print line[:-1],
                while 1:
                        line = mail.readline()
                        if not line: break # EOF
-                       if line = '\n': break # Blank line ends headers
-                       if line[:8] = 'Subject:':
+                       if line == '\n': break # Blank line ends headers
+                       if line[:8] == 'Subject:':
                                print `line[9:-1]`,
                print
index db0f469db0d3dcba1838338a6073f5a8a8767819..afd46f36b3e47a6766c732b4c6e5eefc72454a91 100755 (executable)
@@ -23,7 +23,7 @@ def main():
                # Strip '-P' from printer names just in case
                # the user specified it...
                for i in range(len(printers)):
-                       if printers[i][:2] = '-P':
+                       if printers[i][:2] == '-P':
                                printers[i] = printers[i][2:]
        else:
                if posix.environ.has_key('PRINTER'):
@@ -54,13 +54,13 @@ def makestatus(name, thisuser):
                if not line: break
                fields = string.split(line)
                n = len(fields)
-               if len(fields) >= 6 and fields[n-1] = 'bytes':
+               if len(fields) >= 6 and fields[n-1] == 'bytes':
                        rank = fields[0]
                        user = fields[1]
                        job = fields[2]
                        files = fields[3:-2]
                        bytes = eval(fields[n-2])
-                       if user = thisuser:
+                       if user == thisuser:
                                userseen = 1
                        elif not userseen:
                                aheadbytes = aheadbytes + bytes
@@ -77,9 +77,9 @@ def makestatus(name, thisuser):
                else:
                        if fields and fields[0] <> 'Rank':
                                line = string.strip(line)
-                               if line = 'no entries':
+                               if line == 'no entries':
                                        line = name + ': idle'
-                               elif line[-22:] = ' is ready and printing':
+                               elif line[-22:] == ' is ready and printing':
                                        line = name
                                lines.append(line)
        #
@@ -87,12 +87,12 @@ def makestatus(name, thisuser):
                line = `(totalbytes+1023)/1024` + ' K'
                if totaljobs <> len(users):
                        line = line + ' (' + `totaljobs` + ' jobs)'
-               if len(users) = 1:
+               if len(users) == 1:
                        line = line + ' for ' + users.keys()[0]
                else:
                        line = line + ' for ' + `len(users)` + ' users'
                        if userseen:
-                               if aheadjobs = 0:
+                               if aheadjobs == 0:
                                  line =  line + ' (' + thisuser + ' first)'
                                else:
                                  line = line + ' (' + `(aheadbytes+1023)/1024`
index 5e19db6b132fa8e8f7ac30ae2b1f6cbad2f3ed57..74a66a7a471c6161a862a1ccdefd1b3b012c9c40 100755 (executable)
@@ -19,7 +19,7 @@ def main():
                # Print common digits
                d, d1 = a/b, a1/b1
                #print a, b, a1, b1
-               while d = d1:
+               while d == d1:
                        # Use write() to avoid spaces between the digits
                        sys.stdout.write(`int(d)`)
                        # Flush so the output is seen immediately
index 487acef17d0c2c430b1e2d07db96fb8f0dd9d63a..6a36d6e12150623467556533debf966ee85ed9a8 100755 (executable)
@@ -17,7 +17,7 @@ def primes(min, max):
        i = 3
        while i <= max:
                for p in primes:
-                       if i%p = 0 or p*p > i: break
+                       if i%p == 0 or p*p > i: break
                if i%p <> 0:
                        primes.append(i)
                        if i >= min: print i
index ee16c76110fda973168fa069f5b532ee35e5f35c..f00268b269d995d95a8d19ffe029eec7bada4e36 100644 (file)
@@ -16,7 +16,7 @@ day_0 = 3             # The epoch begins on a Thursday (Monday = 0)
 
 # Return 1 for leap years, 0 for non-leap years
 def isleap(year):
-       return year % 4 = 0 and (year % 100 <> 0 or year % 400 = 0)
+       return year % 4 == 0 and (year % 100 <> 0 or year % 400 == 0)
 
 # Constants for months referenced later
 January = 1
@@ -45,7 +45,7 @@ def gmtime(secs):
        yday = days
        month = January
        while 1:
-               md = mdays[month] + (month = February and isleap(year))
+               md = mdays[month] + (month == February and isleap(year))
                if days < md: break
                days = days - md
                month = month + 1
@@ -122,7 +122,7 @@ def weekday(year, month, day):
 # Return weekday (0-6 ~ Mon-Sun) and number of days (28-31) for year, month
 def monthrange(year, month):
        day1 = weekday(year, month, 1)
-       ndays = mdays[month] + (month = February and isleap(year))
+       ndays = mdays[month] + (month == February and isleap(year))
        return day1, ndays
 
 # Return a matrix representing a month's calendar
@@ -161,7 +161,7 @@ def center(str, width):
 # Print a single week (no newline)
 def prweek(week, width):
        for day in week:
-               if day = 0: print ' '*width,
+               if day == 0: print ' '*width,
                else:
                        if width > 2: print ' '*(width-3),
                        if day < 10: print '',
index 32b77fac9bd49d613a6124eba64d5a8fdacb2b7a..1b48c679a43a4528f4f68e74f15306fbc93889ad 100644 (file)
@@ -19,7 +19,7 @@ def cmp(f1, f2): # Compare two files, use the cache if possible.
        if s1[0] <> 8 or s2[0] <> 8:
                # Either is a not a plain file -- always report as different
                return 0
-       if s1 = s2:
+       if s1 == s2:
                # type, size & mtime match -- report same
                return 1
        if s1[:2] <> s2[:2]: # Types or sizes differ, don't bother
@@ -30,7 +30,7 @@ def cmp(f1, f2): # Compare two files, use the cache if possible.
        try:
                cs1, cs2, outcome = cache[key]
                # cache hit
-               if s1 = cs1 and s2 = cs2:
+               if s1 == cs1 and s2 == cs2:
                        # cached signatures match
                        return outcome
                # stale cached signature(s)
index e846f58ece714977d8db1d7becb8d0223496c07c..20202e266b918fb61a034844cd6559147f5cbdea 100644 (file)
@@ -29,7 +29,7 @@ def cmp(f1, f2):
        if not S_ISREG(s1[0]) or not S_ISREG(s2[0]):
                # Either is a not a plain file -- always report as different
                return 0
-       if s1 = s2:
+       if s1 == s2:
                # type, size & mtime match -- report same
                return 1
        if s1[:2] <> s2[:2]: # Types or sizes differ, don't bother
@@ -40,7 +40,7 @@ def cmp(f1, f2):
        if cache.has_key(key):
                cs1, cs2, outcome = cache[key]
                # cache hit
-               if s1 = cs1 and s2 = cs2:
+               if s1 == cs1 and s2 == cs2:
                        # cached signatures match
                        return outcome
                # stale cached signature(s)
index 4d16eefaa4bc55d9c06bc153a4ce0e094bac0d60..a6084a5a7b3906f06d9b908b1b81ca9aaa2b1d5e 100644 (file)
@@ -25,8 +25,8 @@ def getstatusoutput(cmd):
        pipe = posix.popen('{ ' + cmd + '; } 2>&1', 'r')
        text = pipe.read()
        sts = pipe.close()
-       if sts = None: sts = 0
-       if text[-1:] = '\n': text = text[:-1]
+       if sts == None: sts = 0
+       if text[-1:] == '\n': text = text[:-1]
        return sts, text
 
 
index 0c6b4a7dcf3aab6b5305b5a1a3cf56e40f37f425..f4eea1f2ae2880c9b17c4ca99ed7183dd07f360d 100644 (file)
@@ -174,7 +174,7 @@ def cmp(a, b):
 #
 def remove(list, item):
        for i in range(len(list)):
-               if list[i] = item:
+               if list[i] == item:
                        del list[i]
                        break
 
index 7eaaeaf260521a17b999f44f02b3a3303050755a..28faee04a9ee23b717d104d304b41a19fb74347e 100644 (file)
@@ -22,8 +22,8 @@ def disassemble(co, lasti):
        while i < n:
                c = code[i]
                op = ord(c)
-               if op = SET_LINENO and i > 0: print # Extra blank line
-               if i = lasti: print '-->',
+               if op == SET_LINENO and i > 0: print # Extra blank line
+               if i == lasti: print '-->',
                else: print '   ',
                if i in labels: print '>>',
                else: print '  ',
index cecc275f75bc6548d017bcbafea54f5e9b5a6607..ec895b7e07e886504030f6293e6111b521117dcd 100644 (file)
@@ -31,7 +31,7 @@ def dumpsymtab(dict):
 def dumpvar(name, x):
        import sys
        t = type(x)
-       if t = type({}):
+       if t == type({}):
                print name, '= {}'
                for key in x.keys():
                        item = x[key]
@@ -42,7 +42,7 @@ def dumpvar(name, x):
                if not printable(x):
                        print '#',
                print name, '=', `x`
-       elif t = type(sys):
+       elif t == type(sys):
                print 'import', name, '#', x
        else:
                print '#', name, '=', x
@@ -58,6 +58,6 @@ def printable(x):
                        if not printable(item):
                                return 0
                return 1
-       if x = {}:
+       if x == {}:
                return 1
        return 0
index 1e7dbb31889129343c8a4b9017613a1246de5ca8..549e0e7f01859e8781ce1073d671fc599e39867f 100644 (file)
@@ -5,64 +5,70 @@ def fnmatch(name, pat):
        # Check for simple case: no special characters
        #
        if not ('*' in pat or '?' in pat or '[' in pat):
-               return name = pat
+               return name == pat
        #
        # Check for common cases: *suffix and prefix*
        #
-       if pat[0] = '*':
+       if pat[0] == '*':
                p1 = pat[1:]
                if not ('*' in p1 or '?' in p1 or '[' in p1):
                        start = len(name) - len(p1)
-                       return start >= 0 and name[start:] = p1
-       elif pat[-1:] = '*':
+                       return start >= 0 and name[start:] == p1
+       elif pat[-1:] == '*':
                p1 = pat[:-1]
                if not ('*' in p1 or '?' in p1 or '[' in p1):
-                       return name[:len(p1)] = p1
+                       return name[:len(p1)] == p1
        #
        # General case
        #
        return fnmatch1(name, pat)
 
 def fnmatch1(name, pat):
-       for i in range(len(pat)):
+       i, n = 0, len(pat)
+       while i < n:
                c = pat[i]
-               if c = '*':
+               if c == '*':
                        p1 = pat[i+1:]
                        if not ('*' in p1 or '?' in p1 or '[' in p1):
                                start = len(name) - len(p1)
-                               return start >= 0 and name[start:] = p1
+                               return start >= 0 and name[start:] == p1
                        for i in range(i, len(name) + 1):
                                if fnmatch1(name[i:], p1):
                                        return 1
                        return 0
-               elif c = '?':
+               elif c == '?':
                        if len(name) <= i : return 0
-               elif c = '[':
+               elif c == '[':
                        c, rest = name[i], name[i+1:]
                        i, n = i+1, len(pat) - 1
                        match = 0
                        exclude = 0
-                       if i < n and pat[i] = '!':
+                       if i < n and pat[i] == '!':
                                exclude = 1
                                i = i+1
                        while i < n:
-                               if pat[i] = c: match = 1
+                               if pat[i] == c: match = 1
                                i = i+1
-                               if i >= n or pat[i] = ']':
+                               if i >= n or pat[i] == ']':
                                        break
-                               if pat[i] = '-':
+                               if pat[i] == '-':
                                        i = i+1
-                                       if i >= n or pat[i] = ']':
+                                       if i >= n or pat[i] == ']':
                                                break
-                                       match = (pat[i-2] <= c <= pat[i])
+                                       if pat[i-2] <= c <= pat[i]:
+                                               match = 1
                                        i = i+1
-                       if match = exclude:
+                                       if i >= n or pat[i] == ']':
+                                               break
+                       if match == exclude:
                                return 0
                        return fnmatch1(rest, pat[i+1:])
                else:
                        if name[i:i+1] <> c:
                                return 0
-       return 1
+               i = i+1
+       # We don't get here if the pattern contained * or [...]
+       return i >= len(name)
 
 def fnmatchlist(names, pat):
        res = []
index ef72fbc0b220a34625ecf56f177f49277ef270b2..0b71d0f3a7af22126ff38710a2de21e793d9d970 100644 (file)
@@ -22,15 +22,15 @@ error = 'getopt error'
 
 def getopt(args, options):
     list = []
-    while args and args[0][0] = '-' and args[0] <> '-':
-       if args[0] = '--':
+    while args and args[0][0] == '-' and args[0] <> '-':
+       if args[0] == '--':
            args = args[1:]
            break
        optstring, args = args[0][1:], args[1:]
        while optstring <> '':
            opt, optstring = optstring[0], optstring[1:]
            if classify(opt, options): # May raise exception as well
-               if optstring = '':
+               if optstring == '':
                    if not args:
                        raise error, 'option -' + opt + ' requires argument'
                    optstring, args = args[0], args[1:]
@@ -42,6 +42,6 @@ def getopt(args, options):
 
 def classify(opt, options): # Helper to check type of option
     for i in range(len(options)):
-       if opt = options[i] <> ':':
-           return options[i+1:i+2] = ':'
+       if opt == options[i] <> ':':
+           return options[i+1:i+2] == ':'
     raise error, 'option -' + opt + ' not recognized'
index e29095c5ef04a5df36b99a53d40fa05ce8a72f01..4c7e08401631f8ee8809196062539923886c8858 100644 (file)
@@ -7,7 +7,7 @@ import fnmatch
 def glob(pathname):
        if not has_magic(pathname): return [pathname]
        dirname, basename = path.split(pathname)
-       if dirname[-1:] = '/' and dirname <> '/':
+       if dirname[-1:] == '/' and dirname <> '/':
                dirname = dirname[:-1]
        if has_magic(dirname):
                list = glob(dirname)
@@ -34,9 +34,10 @@ def glob1(dirname, pattern):
                names = posix.listdir(dirname)
        except posix.error:
                return []
+       names.sort()
        result = []
        for name in names:
-               if name[0] <> '.' or pattern[0] = '.':
+               if name[0] <> '.' or pattern[0] == '.':
                        if fnmatch.fnmatch(name, pattern): result.append(name)
        return result
 
index bfee3f5e8e649835d376ae8174fe6c9115554a89..21ef8d80171aa20f77cf0b3a0e0e149c69125ce8 100644 (file)
@@ -30,7 +30,7 @@ def ggrep(syntax, pat, filename):
                        prefix = string.rjust(`lineno`, 3) + ': '
                        print prefix + line
                        if 0: # XXX
-                               start, end = prog.regs()[0]
+                               start, end = prog.regs[0]
                                line = line[:start]
                                if '\t' not in line:
                                        prefix = ' ' * (len(prefix) + start)
index 549c0a7a3464a3c1fbfe588e787bc62f5332597d..fb992a95946499185a578de59e9bec468c54a827 100755 (executable)
@@ -69,7 +69,7 @@ def stretch(s, a, b):
                        ib = ib+b
                if i >= m:
                        break
-               if ib = ja:
+               if ib == ja:
                        out.append(y[i])
                else:
                        out.append((y[i]*(ja-(ib-b)) + y[i-1]*(ib-ja)) / b)
index 71a8f66891c1dca16c9d01929534a118d0ae8756..dfbad01d382ff67413f55d80dad26a8cfe247db1 100755 (executable)
@@ -49,7 +49,7 @@ def parse_forms(filename):
 def _open_formfile(filename):
     if filename[-3:] <> '.fd':
        filename = filename + '.fd'
-    if filename[0] = '/':
+    if filename[0] == '/':
        try:
            fp = open(filename,'r')
        except IOError:
@@ -62,7 +62,7 @@ def _open_formfile(filename):
                break
            except IOError:
                fp = None
-    if fp = None:
+    if fp == None:
        raise error, 'Cannot find forms file ' + filename
     return fp
 
@@ -77,7 +77,7 @@ def _parse_fd_header(file):
     # Now skip until we know number of forms
     while 1:
        datum = _parse_1_line(file)
-       if type(datum) = type(()) and datum[0] = 'Numberofforms':
+       if type(datum) == type(()) and datum[0] == 'Numberofforms':
            break
     return datum[1]
 #
@@ -89,7 +89,7 @@ def _parse_fd_form(file, name):
     if datum <> FORMLINE:
        raise error, 'Missing === FORM === line'
     form = _parse_object(file)
-    if form.Name = name or name = None:
+    if form.Name == name or name == None:
        objs = []
        for j in range(form.Numberofobjects):
            obj = _parse_object(file)
@@ -147,7 +147,7 @@ def _parse_line(line):
     if not a:
        return line
     name = line[:a[1][1]]
-    if name[0] = 'N':
+    if name[0] == 'N':
            name = string.joinfields(string.split(name),'')
            name = string.lower(name)
     name = string.upper(name[0]) + name[1:]
@@ -167,7 +167,7 @@ def _readline(file):
        
 def _parse_1_line(file):
     line = _readline(file)
-    while line = '':
+    while line == '':
        line = _readline(file)
     return _parse_line(line)
 
@@ -176,7 +176,7 @@ def _skip_object(file):
     while not line in (SPLITLINE, FORMLINE, ENDLINE):
        pos = file.tell()
        line = _readline(file)
-    if line = FORMLINE:
+    if line == FORMLINE:
        file.seek(pos)
 
 def _parse_object(file):
@@ -185,7 +185,7 @@ def _parse_object(file):
        pos = file.tell()
        datum = _parse_1_line(file)
        if datum in (SPLITLINE, FORMLINE, ENDLINE):
-           if datum = FORMLINE:
+           if datum == FORMLINE:
                file.seek(pos)
            return obj
        if type(datum) <> type(()):
@@ -266,27 +266,27 @@ def _create_object(form, odata):
 # Internal crfunc: helper function that returns correct create function
 #
 def _select_crfunc(fm, cl):
-    if cl = FL.BEGIN_GROUP: return fm.bgn_group
-    elif cl = FL.END_GROUP: return fm.end_group
-    elif cl = FL.BITMAP: return fm.add_bitmap
-    elif cl = FL.BOX: return fm.add_box
-    elif cl = FL.BROWSER: return fm.add_browser
-    elif cl = FL.BUTTON: return fm.add_button
-    elif cl = FL.CHART: return fm.add_chart
-    elif cl = FL.CHOICE: return fm.add_choice
-    elif cl = FL.CLOCK: return fm.add_clock
-    elif cl = FL.COUNTER: return fm.add_counter
-    elif cl = FL.DIAL: return fm.add_dial
-    elif cl = FL.FREE: return fm.add_free
-    elif cl = FL.INPUT: return fm.add_input
-    elif cl = FL.LIGHTBUTTON: return fm.add_lightbutton
-    elif cl = FL.MENU: return fm.add_menu
-    elif cl = FL.POSITIONER: return fm.add_positioner
-    elif cl = FL.ROUNDBUTTON: return fm.add_roundbutton
-    elif cl = FL.SLIDER: return fm.add_slider
-    elif cl = FL.VALSLIDER: return fm.add_valslider
-    elif cl = FL.TEXT: return fm.add_text
-    elif cl = FL.TIMER: return fm.add_timer
+    if cl == FL.BEGIN_GROUP: return fm.bgn_group
+    elif cl == FL.END_GROUP: return fm.end_group
+    elif cl == FL.BITMAP: return fm.add_bitmap
+    elif cl == FL.BOX: return fm.add_box
+    elif cl == FL.BROWSER: return fm.add_browser
+    elif cl == FL.BUTTON: return fm.add_button
+    elif cl == FL.CHART: return fm.add_chart
+    elif cl == FL.CHOICE: return fm.add_choice
+    elif cl == FL.CLOCK: return fm.add_clock
+    elif cl == FL.COUNTER: return fm.add_counter
+    elif cl == FL.DIAL: return fm.add_dial
+    elif cl == FL.FREE: return fm.add_free
+    elif cl == FL.INPUT: return fm.add_input
+    elif cl == FL.LIGHTBUTTON: return fm.add_lightbutton
+    elif cl == FL.MENU: return fm.add_menu
+    elif cl == FL.POSITIONER: return fm.add_positioner
+    elif cl == FL.ROUNDBUTTON: return fm.add_roundbutton
+    elif cl == FL.SLIDER: return fm.add_slider
+    elif cl == FL.VALSLIDER: return fm.add_valslider
+    elif cl == FL.TEXT: return fm.add_text
+    elif cl == FL.TIMER: return fm.add_timer
     else:
        raise error, 'Unknown object type: ' + `cl`
 
index 9fda1c6633c05e6deb8f254729aa6f99d474b825..21a17ba0ae7fd925a489b7ecc29e936b8eea5e2d 100755 (executable)
@@ -17,7 +17,7 @@ debug = 0
 # Test if an object is a list.
 #
 def is_list(x):
-       return type(x) = type([])
+       return type(x) == type([])
 
 
 # Reverse a list.
@@ -34,7 +34,7 @@ def reverse(list):
 #
 def getattrlist(list, name):
        for item in list:
-               if item and is_list(item) and item[0] = name:
+               if item and is_list(item) and item[0] == name:
                        return item[1:]
        return []
 
@@ -43,8 +43,8 @@ def getattrlist(list, name):
 #
 def getproplist(list, name):
        for item in list:
-               if item and is_list(item) and item[0] = 'prop':
-                       if len(item) > 1 and item[1] = name:
+               if item and is_list(item) and item[0] == 'prop':
+                       if len(item) > 1 and item[1] == name:
                                return item[2:]
        return []
 
@@ -53,7 +53,7 @@ def getproplist(list, name):
 #
 def is_endgroup(list):
        x = getproplist(list, 'end-of-group')
-       return (x and x[0] = '#t')
+       return (x and x[0] == '#t')
 
 
 # Neatly display an actuator definition given as S-expression
@@ -63,13 +63,13 @@ def show_actuator(prefix, a):
        for item in a:
                if not is_list(item):
                        print prefix, item
-               elif item and item[0] = 'al':
+               elif item and item[0] == 'al':
                        print prefix, 'Subactuator list:'
                        for a in item[1:]:
                                show_actuator(prefix + '    ', a)
-               elif len(item) = 2:
+               elif len(item) == 2:
                        print prefix, item[0], '=>', item[1]
-               elif len(item) = 3 and item[0] = 'prop':
+               elif len(item) == 3 and item[0] == 'prop':
                        print prefix, 'Prop', item[1], '=>',
                        print item[2]
                else:
@@ -82,13 +82,13 @@ def show_panel(prefix, p):
        for item in p:
                if not is_list(item):
                        print prefix, item
-               elif item and item[0] = 'al':
+               elif item and item[0] == 'al':
                        print prefix, 'Actuator list:'
                        for a in item[1:]:
                                show_actuator(prefix + '    ', a)
-               elif len(item) = 2:
+               elif len(item) == 2:
                        print prefix, item[0], '=>', item[1]
-               elif len(item) = 3 and item[0] = 'prop':
+               elif len(item) == 3 and item[0] == 'prop':
                        print prefix, 'Prop', item[1], '=>',
                        print item[2]
                else:
@@ -112,14 +112,14 @@ def dummy_callback(arg):
 #
 def assign_members(target, attrlist, exclist, prefix):
        for item in attrlist:
-               if is_list(item) and len(item) = 2 and item[0] not in exclist:
+               if is_list(item) and len(item) == 2 and item[0] not in exclist:
                        name, value = item[0], item[1]
                        ok = 1
                        if value[0] in '-0123456789':
                                value = eval(value)
-                       elif value[0] = '"':
+                       elif value[0] == '"':
                                value = value[1:-1]
-                       elif value = 'move-then-resize':
+                       elif value == 'move-then-resize':
                                # Strange default set by Panel Editor...
                                ok = 0
                        else:
@@ -148,7 +148,7 @@ def build_actuator(descr):
        else:
                actuatorname = ''
        type = descr[0]
-       if type[:4] = 'pnl_': type = type[4:]
+       if type[:4] == 'pnl_': type = type[4:]
        act = pnl.mkact(type)
        act.downfunc = act.activefunc = act.upfunc = dummy_callback
        #
@@ -158,9 +158,9 @@ def build_actuator(descr):
        #
        datalist = getattrlist(descr, 'data')
        prefix = ''
-       if type[-4:] = 'puck':
+       if type[-4:] == 'puck':
                prefix = 'puck_'
-       elif type = 'mouse':
+       elif type == 'mouse':
                prefix = 'mouse_'
        assign_members(act, datalist, [], prefix)
        #
index 9c9ee022750a5e64a76e1eaa6e135e268a48c1b2..1b069fa0752178a1b255d9435598704991d8fe5d 100755 (executable)
@@ -20,16 +20,16 @@ def tokenize_string(s):
                c = s[:1]
                if c in whitespace:
                        s = s[1:]
-               elif c = ';':
+               elif c == ';':
                        s = ''
-               elif c = '"':
+               elif c == '"':
                        n = len(s)
                        i = 1
                        while i < n:
                                c = s[i]
                                i = i+1
-                               if c = '"': break
-                               if c = '\\': i = i+1
+                               if c == '"': break
+                               if c == '\\': i = i+1
                        tokens.append(s[:i])
                        s = s[i:]
                elif c in operators:
@@ -78,9 +78,9 @@ def parse_expr(tokens):
        while 1:
                if not tokens:
                        raise syntax_error, 'missing ")"'
-               if tokens[0] = ')':
+               if tokens[0] == ')':
                        return expr, tokens[1:]
-               elif tokens[0] = '(':
+               elif tokens[0] == '(':
                        subexpr, tokens = parse_expr(tokens)
                        expr.append(subexpr)
                else:
index cecc275f75bc6548d017bcbafea54f5e9b5a6607..ec895b7e07e886504030f6293e6111b521117dcd 100644 (file)
@@ -31,7 +31,7 @@ def dumpsymtab(dict):
 def dumpvar(name, x):
        import sys
        t = type(x)
-       if t = type({}):
+       if t == type({}):
                print name, '= {}'
                for key in x.keys():
                        item = x[key]
@@ -42,7 +42,7 @@ def dumpvar(name, x):
                if not printable(x):
                        print '#',
                print name, '=', `x`
-       elif t = type(sys):
+       elif t == type(sys):
                print 'import', name, '#', x
        else:
                print '#', name, '=', x
@@ -58,6 +58,6 @@ def printable(x):
                        if not printable(item):
                                return 0
                return 1
-       if x = {}:
+       if x == {}:
                return 1
        return 0
index bfee3f5e8e649835d376ae8174fe6c9115554a89..21ef8d80171aa20f77cf0b3a0e0e149c69125ce8 100644 (file)
@@ -30,7 +30,7 @@ def ggrep(syntax, pat, filename):
                        prefix = string.rjust(`lineno`, 3) + ': '
                        print prefix + line
                        if 0: # XXX
-                               start, end = prog.regs()[0]
+                               start, end = prog.regs[0]
                                line = line[:start]
                                if '\t' not in line:
                                        prefix = ' ' * (len(prefix) + start)
index 9d07d6ceb28e1123f877b623d3a58629a8a3200f..4994bf9100f032b04c34890bcbb5db259ba22bf6 100644 (file)
@@ -53,7 +53,7 @@ def listattrs(x):
        return total
        i = 0
        while i+1 < len(total):
-               if total[i] = total[i+1]:
+               if total[i] == total[i+1]:
                        del total[i+1]
                else:
                        i = i+1
@@ -62,7 +62,7 @@ def listattrs(x):
 # Helper to recognize functions
 #
 def is_function(x):
-       return type(x) = type(is_function)
+       return type(x) == type(is_function)
 
 # Approximation of builtin dir(); this lists the user's
 # variables by default, not the current local name space.
@@ -71,7 +71,7 @@ def is_function(x):
 #
 class _dirclass:
        def dir(args):
-               if type(args) = type(()):
+               if type(args) == type(()):
                        return listattrs(args[1])
                else:
                        import __main__
index ec631049ecc3032db96a4d8e45c5807621e3788e..ef0c4b50d235b20780de0b4b55aad8051d7a84ca 100644 (file)
@@ -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
index 949e128e5cc61995444e692b67c94a88fd2bd4d6..d1435d3acfbc9b55f5e97a1a1ed88e0f122718ab 100644 (file)
@@ -110,7 +110,7 @@ class LabelAppearance:
        #
        def draw(self, (d, area)):
                area = _rect.intersect(area, self.bounds)
-               if area = _rect.empty:
+               if area == _rect.empty:
                        return
                d.cliprect(area)
                self.drawit(d)
index 5c57d9023e85a57e4fe00469f12861da8477c754..90d137e6fcb0f510486affb6282e90ba0a14c5c1 100644 (file)
@@ -43,7 +43,7 @@ class CSplit(Split):
                # XXX One day Python will have automatic conversions...
                n = len(self.children)
                fn = float(n)
-               if n = 0: return
+               if n == 0: return
                (left, top), (right, bottom) = bounds
                width, height = right-left, bottom-top
                child_width, child_height = width*3/(n+4), height*3/(n+4)
index 20a0fe8bb70ef6cb62684bee2f4ff03b690f6015..0066c58fe9987057eb2d87e9b6281f6bb0665e9d 100644 (file)
@@ -25,7 +25,7 @@ class DirList(VSplit):
                        if path.isdir(path.join(dirname, name)):
                                fullname = path.join(dirname, name)
                                btn = SubdirButton().definetext(self, fullname)
-                       elif name[-3:] = '.py':
+                       elif name[-3:] == '.py':
                                btn = ModuleButton().definetext(self, name)
                        else:
                                btn = FileButton().definetext(self, name)
index b169d726e2ef3e9e40c50965b953e0c732598177..aacfa9896909d791613fc08f4af42e2158b480a4 100644 (file)
@@ -116,7 +116,7 @@ class Split:
                if not self.keybd_focus:
                        self.set_keybd_focus(self.keybd_interest[0])
                type, detail = type_detail
-               if type = WE_COMMAND and detail = WC_TAB and \
+               if type == WE_COMMAND and detail == WC_TAB and \
                                        len(self.keybd_interest) > 1:
                        self.next_keybd_focus()
                        return
@@ -144,9 +144,9 @@ class Split:
                        self.timer_interest.remove(child)
                if child in self.altdraw_interest:
                        self.altdraw_interest.remove(child)
-               if child = self.mouse_focus:
+               if child == self.mouse_focus:
                        self.mouse_focus = None
-               if child = self.keybd_focus:
+               if child == self.keybd_focus:
                        self.keybd_focus = None
        #
        def need_mouse(self, child):
@@ -154,7 +154,7 @@ class Split:
                        self.mouse_interest.append(child)
                        self.parent.need_mouse(self)
        def no_mouse(self, child):
-               if child = self.mouse_focus:
+               if child == self.mouse_focus:
                        self.mouse_focus = None
                if child in self.mouse_interest:
                        self.mouse_interest.remove(child)
@@ -168,7 +168,7 @@ class Split:
                if not self.keybd_focus:
                        self.set_keybd_focus(child)
        def no_keybd(self, child):
-               if child = self.keybd_focus:
+               if child == self.keybd_focus:
                        self.keybd_focus = None # Don't call child.deactivate()
                if child in self.keybd_interest:
                        self.keybd_interest.remove(child)
index d58f835ce750cf29aba2bbb18b60377ff92b2701..5bce412069ef387c7a754a7abcfd0db5ed7b17d7 100644 (file)
@@ -51,7 +51,7 @@ class StripChart(LabelAppearance, NoReactivity):
        #
        def draw(self, (d, area)):
                area = rect.intersect(area, self.bounds)
-               if area = rect.empty:
+               if area == rect.empty:
                        return
                d.cliprect(area)
                d.erase(self.bounds)
index a0593c5f234a59cdb5f9d77c66d096e0f9b900cf..697ed07b74c8824b44ddb5e9e7ace4971b5f90a8 100644 (file)
@@ -149,26 +149,26 @@ class WindowParent(ManageOneChild):
        # Only call dispatch once we are realized
        #
        def dispatch(self, (type, win, detail)):
-               if type = WE_DRAW:
+               if type == WE_DRAW:
                        d = self.win.begindrawing()
                        self.child.draw(d, detail)
                        del d
                        if self.do_altdraw: self.child.altdraw(detail)
-               elif type = WE_MOUSE_DOWN:
+               elif type == WE_MOUSE_DOWN:
                        if self.do_mouse: self.child.mouse_down(detail)
-               elif type = WE_MOUSE_MOVE:
+               elif type == WE_MOUSE_MOVE:
                        if self.do_mouse: self.child.mouse_move(detail)
-               elif type = WE_MOUSE_UP:
+               elif type == WE_MOUSE_UP:
                        if self.do_mouse: self.child.mouse_up(detail)
                elif type in (WE_CHAR, WE_COMMAND):
                        if self.do_keybd: self.child.keybd(type, detail)
-               elif type = WE_TIMER:
+               elif type == WE_TIMER:
                        if self.do_timer: self.child.timer()
-               elif type = WE_SIZE:
+               elif type == WE_SIZE:
                        self.fixup()
-               elif type = WE_CLOSE:
+               elif type == WE_CLOSE:
                        self.close_trigger()
-               elif type = WE_MENU:
+               elif type == WE_MENU:
                        self.menu_trigger(detail)
                if self.pending_destroy:
                        self.destroy()
index 912531752d484ba4ccbe4c1c16bd61f4e0fba697..67c3afbe22c2e1e6840eac11f1e7919d5d0f3d52 100644 (file)
@@ -21,7 +21,7 @@ def delayfunc(msecs):
        #
        # Use millisleep for very short delays or if there are no windows
        #
-       if msecs < 100 or mainloop.countwindows() = 0:
+       if msecs < 100 or mainloop.countwindows() == 0:
                if msecs > 0:
                        time.millisleep(msecs)
                return
@@ -46,7 +46,7 @@ cancel = q.cancel
 # Emptiness check must check both queues
 #
 def empty():
-       return q.empty() and mainloop.countwindows() = 0
+       return q.empty() and mainloop.countwindows() == 0
 
 # Run until there is nothing left to do
 #
index d0a852503697d73e521aea81402c3aa5b345b7ab..beb522292127a48e15b4c911e764d0d07dc3b654 100644 (file)
@@ -10,7 +10,7 @@ import dircache
 
 def action(w, string, i, detail):
        (h, v), clicks, button, mask = detail
-       if clicks = 2:
+       if clicks == 2:
                name = path.join(w.name, string)
                try:
                        w2 = anywin.open(name)
index aea7deb6e5e7b6baa1e055c28c4c1325e3a6bed6..b2d4add7e0a4e0355e41ba09fe78f1e9a18eb703 100644 (file)
@@ -175,20 +175,20 @@ def test():
        winsize = w.getwinsize()
        while 1:
                type, window, detail = stdwinq.getevent()
-               if type = WE_CLOSE:
+               if type == WE_CLOSE:
                        break
-               elif type = WE_SIZE:
+               elif type == WE_SIZE:
                        newsize = w.getwinsize()
                        if newsize <> winsize:
                                w.change((0,0), winsize)
                                winsize = newsize
                                w.change((0,0), winsize)
-               elif type = WE_MOUSE_DOWN:
+               elif type == WE_MOUSE_DOWN:
                        stage = (stage + 1) % len(stages)
                        justify, center, title = stages[stage]
                        w.settitle(title)
                        w.change((0, 0), (1000, 1000))
-               elif type = WE_DRAW:
+               elif type == WE_DRAW:
                        width, height = winsize
                        f = formatter().init(w.begindrawing(), 0, 0, width)
                        f.center = center
@@ -198,7 +198,7 @@ def test():
                        for font in font1, font2, font1:
                                f.setfont(font)
                                for word in words:
-                                       space = 1 + (word[-1:] = '.')
+                                       space = 1 + (word[-1:] == '.')
                                        f.addword(word, space)
                                        if center and space > 1:
                                                f.flush()
index c2ec11f9270f6a2411fa6c2f56f5952f937ebc03..12ed90bba010edb3934c1b1a647dcbb9f5d04bd5 100644 (file)
@@ -49,44 +49,44 @@ def mainloop():                             # Handle events until no windows left
 
 def treatevent(e):                     # Handle a stdwin event
        type, w, detail = e
-       if type = WE_DRAW:
+       if type == WE_DRAW:
                w.draw(w, detail)
-       elif type = WE_MENU:
+       elif type == WE_MENU:
                m, item = detail
                m.action[item](w, m, item)
-       elif type = WE_COMMAND:
+       elif type == WE_COMMAND:
                treatcommand(w, detail)
-       elif type = WE_CHAR:
+       elif type == WE_CHAR:
                w.char(w, detail)
-       elif type = WE_MOUSE_DOWN:
+       elif type == WE_MOUSE_DOWN:
                if detail[1] > 1: w.m2down(w, detail)
                else: w.mdown(w, detail)
-       elif type = WE_MOUSE_MOVE:
+       elif type == WE_MOUSE_MOVE:
                w.mmove(w, detail)
-       elif type = WE_MOUSE_UP:
+       elif type == WE_MOUSE_UP:
                if detail[1] > 1: w.m2up(w, detail)
                else: w.mup(w, detail)
-       elif type = WE_SIZE:
+       elif type == WE_SIZE:
                w.size(w, w.getwinsize())
-       elif type = WE_ACTIVATE:
+       elif type == WE_ACTIVATE:
                w.activate(w)
-       elif type = WE_DEACTIVATE:
+       elif type == WE_DEACTIVATE:
                w.deactivate(w)
-       elif type = WE_MOVE:
+       elif type == WE_MOVE:
                w.move(w)
-       elif type = WE_TIMER:
+       elif type == WE_TIMER:
                w.timer(w)
-       elif type = WE_CLOSE:
+       elif type == WE_CLOSE:
                w.close(w)
 
 def treatcommand(w, type):             # Handle a we_command event
-       if type = WC_CLOSE:
+       if type == WC_CLOSE:
                w.close(w)
-       elif type = WC_RETURN:
+       elif type == WC_RETURN:
                w.enter(w)
-       elif type = WC_TAB:
+       elif type == WC_TAB:
                w.tab(w)
-       elif type = WC_BACKSPACE:
+       elif type == WC_BACKSPACE:
                w.backspace(w)
        elif type in (WC_LEFT, WC_UP, WC_RIGHT, WC_DOWN):
                w.arrow(w, type)
@@ -101,13 +101,13 @@ def close(w):                             # Close method
                        break
 
 def arrow(w, detail):                  # Arrow key method
-       if detail = WC_LEFT:
+       if detail == WC_LEFT:
                w.kleft(w)
-       elif detail = WC_UP:
+       elif detail == WC_UP:
                w.kup(w)
-       elif detail = WC_RIGHT:
+       elif detail == WC_RIGHT:
                w.kright(w)
-       elif detail = WC_DOWN:
+       elif detail == WC_DOWN:
                w.kdown(w)
 
 
index f9ab90761ff036976816475a73fcf47565b7896e..eba161d6f357718bb7f65e0196859847fea92e91 100644 (file)
@@ -164,13 +164,13 @@ def whichcol(w, h): # Return column number (may be >= len(w.data))
        return len(w.data)
 
 def arrow(w, type):
-       if type = WC_LEFT:
+       if type == WC_LEFT:
                incr = -1, 0
-       elif type = WC_UP:
+       elif type == WC_UP:
                incr = 0, -1
-       elif type = WC_RIGHT:
+       elif type == WC_RIGHT:
                incr = 1, 0
-       elif type = WC_DOWN:
+       elif type == WC_DOWN:
                incr = 0, 1
        else:
                return
index 58cbb88e5003286b4c761dd06c5c91674942838d..533b0524b99c86dbe509b88433564d60a745691b 100644 (file)
@@ -21,7 +21,7 @@ def isabs(s):
 
 def join(s, t):
        if (not s) or isabs(t): return t
-       if t[:1] = ':': t = t[1:]
+       if t[:1] == ':': t = t[1:]
        if ':' not in s:
                s = ':' + s
        if s[-1:] <> ':':
@@ -40,7 +40,7 @@ def split(s):
        if ':' not in s: return '', s
        colon = 0
        for i in range(len(s)):
-               if s[i] = ':': colon = i+1
+               if s[i] == ':': colon = i+1
        return s[:colon], s[colon:]
 
 
index 9d07d6ceb28e1123f877b623d3a58629a8a3200f..4994bf9100f032b04c34890bcbb5db259ba22bf6 100644 (file)
@@ -53,7 +53,7 @@ def listattrs(x):
        return total
        i = 0
        while i+1 < len(total):
-               if total[i] = total[i+1]:
+               if total[i] == total[i+1]:
                        del total[i+1]
                else:
                        i = i+1
@@ -62,7 +62,7 @@ def listattrs(x):
 # Helper to recognize functions
 #
 def is_function(x):
-       return type(x) = type(is_function)
+       return type(x) == type(is_function)
 
 # Approximation of builtin dir(); this lists the user's
 # variables by default, not the current local name space.
@@ -71,7 +71,7 @@ def is_function(x):
 #
 class _dirclass:
        def dir(args):
-               if type(args) = type(()):
+               if type(args) == type(()):
                        return listattrs(args[1])
                else:
                        import __main__
index 065a3eaef3e94c3fed6a36824b7635cbe80910f7..52cc6fb496f5d0001cbfb77f7f233259c71611ea 100755 (executable)
@@ -160,23 +160,23 @@ def dumptype(x, typedict, types, stack):
        typedict[xrepr] = uid
        if typeswitch.has_key(xrepr):
                print FN, '[', `uid`, '] =', typeswitch[xrepr]
-       elif x = type(sys):
+       elif x == type(sys):
                print 'import sys'
                print FN, '[', `uid`, '] = type(sys)'
-       elif x = type(sys.stderr):
+       elif x == type(sys.stderr):
                print 'import sys'
                print FN, '[', `uid`, '] = type(sys.stderr)'
-       elif x = type(dumptype):
+       elif x == type(dumptype):
                print 'def some_function(): pass'
                print FN, '[', `uid`, '] = type(some_function)'
-       elif x = type(some_class):
+       elif x == type(some_class):
                print 'class some_class(): pass'
                print FN, '[', `uid`, '] = type(some_class)'
-       elif x = type(some_instance):
+       elif x == type(some_instance):
                print 'class another_class(): pass'
                print 'some_instance = another_class()'
                print FN, '[', `uid`, '] = type(some_instance)'
-       elif x = type(some_instance.method):
+       elif x == type(some_instance.method):
                print 'class yet_another_class():'
                print '    def method(): pass'
                print 'another_instance = yet_another_class()'
index 71a8f66891c1dca16c9d01929534a118d0ae8756..dfbad01d382ff67413f55d80dad26a8cfe247db1 100755 (executable)
@@ -49,7 +49,7 @@ def parse_forms(filename):
 def _open_formfile(filename):
     if filename[-3:] <> '.fd':
        filename = filename + '.fd'
-    if filename[0] = '/':
+    if filename[0] == '/':
        try:
            fp = open(filename,'r')
        except IOError:
@@ -62,7 +62,7 @@ def _open_formfile(filename):
                break
            except IOError:
                fp = None
-    if fp = None:
+    if fp == None:
        raise error, 'Cannot find forms file ' + filename
     return fp
 
@@ -77,7 +77,7 @@ def _parse_fd_header(file):
     # Now skip until we know number of forms
     while 1:
        datum = _parse_1_line(file)
-       if type(datum) = type(()) and datum[0] = 'Numberofforms':
+       if type(datum) == type(()) and datum[0] == 'Numberofforms':
            break
     return datum[1]
 #
@@ -89,7 +89,7 @@ def _parse_fd_form(file, name):
     if datum <> FORMLINE:
        raise error, 'Missing === FORM === line'
     form = _parse_object(file)
-    if form.Name = name or name = None:
+    if form.Name == name or name == None:
        objs = []
        for j in range(form.Numberofobjects):
            obj = _parse_object(file)
@@ -147,7 +147,7 @@ def _parse_line(line):
     if not a:
        return line
     name = line[:a[1][1]]
-    if name[0] = 'N':
+    if name[0] == 'N':
            name = string.joinfields(string.split(name),'')
            name = string.lower(name)
     name = string.upper(name[0]) + name[1:]
@@ -167,7 +167,7 @@ def _readline(file):
        
 def _parse_1_line(file):
     line = _readline(file)
-    while line = '':
+    while line == '':
        line = _readline(file)
     return _parse_line(line)
 
@@ -176,7 +176,7 @@ def _skip_object(file):
     while not line in (SPLITLINE, FORMLINE, ENDLINE):
        pos = file.tell()
        line = _readline(file)
-    if line = FORMLINE:
+    if line == FORMLINE:
        file.seek(pos)
 
 def _parse_object(file):
@@ -185,7 +185,7 @@ def _parse_object(file):
        pos = file.tell()
        datum = _parse_1_line(file)
        if datum in (SPLITLINE, FORMLINE, ENDLINE):
-           if datum = FORMLINE:
+           if datum == FORMLINE:
                file.seek(pos)
            return obj
        if type(datum) <> type(()):
@@ -266,27 +266,27 @@ def _create_object(form, odata):
 # Internal crfunc: helper function that returns correct create function
 #
 def _select_crfunc(fm, cl):
-    if cl = FL.BEGIN_GROUP: return fm.bgn_group
-    elif cl = FL.END_GROUP: return fm.end_group
-    elif cl = FL.BITMAP: return fm.add_bitmap
-    elif cl = FL.BOX: return fm.add_box
-    elif cl = FL.BROWSER: return fm.add_browser
-    elif cl = FL.BUTTON: return fm.add_button
-    elif cl = FL.CHART: return fm.add_chart
-    elif cl = FL.CHOICE: return fm.add_choice
-    elif cl = FL.CLOCK: return fm.add_clock
-    elif cl = FL.COUNTER: return fm.add_counter
-    elif cl = FL.DIAL: return fm.add_dial
-    elif cl = FL.FREE: return fm.add_free
-    elif cl = FL.INPUT: return fm.add_input
-    elif cl = FL.LIGHTBUTTON: return fm.add_lightbutton
-    elif cl = FL.MENU: return fm.add_menu
-    elif cl = FL.POSITIONER: return fm.add_positioner
-    elif cl = FL.ROUNDBUTTON: return fm.add_roundbutton
-    elif cl = FL.SLIDER: return fm.add_slider
-    elif cl = FL.VALSLIDER: return fm.add_valslider
-    elif cl = FL.TEXT: return fm.add_text
-    elif cl = FL.TIMER: return fm.add_timer
+    if cl == FL.BEGIN_GROUP: return fm.bgn_group
+    elif cl == FL.END_GROUP: return fm.end_group
+    elif cl == FL.BITMAP: return fm.add_bitmap
+    elif cl == FL.BOX: return fm.add_box
+    elif cl == FL.BROWSER: return fm.add_browser
+    elif cl == FL.BUTTON: return fm.add_button
+    elif cl == FL.CHART: return fm.add_chart
+    elif cl == FL.CHOICE: return fm.add_choice
+    elif cl == FL.CLOCK: return fm.add_clock
+    elif cl == FL.COUNTER: return fm.add_counter
+    elif cl == FL.DIAL: return fm.add_dial
+    elif cl == FL.FREE: return fm.add_free
+    elif cl == FL.INPUT: return fm.add_input
+    elif cl == FL.LIGHTBUTTON: return fm.add_lightbutton
+    elif cl == FL.MENU: return fm.add_menu
+    elif cl == FL.POSITIONER: return fm.add_positioner
+    elif cl == FL.ROUNDBUTTON: return fm.add_roundbutton
+    elif cl == FL.SLIDER: return fm.add_slider
+    elif cl == FL.VALSLIDER: return fm.add_valslider
+    elif cl == FL.TEXT: return fm.add_text
+    elif cl == FL.TIMER: return fm.add_timer
     else:
        raise error, 'Unknown object type: ' + `cl`
 
index 9fda1c6633c05e6deb8f254729aa6f99d474b825..21a17ba0ae7fd925a489b7ecc29e936b8eea5e2d 100755 (executable)
@@ -17,7 +17,7 @@ debug = 0
 # Test if an object is a list.
 #
 def is_list(x):
-       return type(x) = type([])
+       return type(x) == type([])
 
 
 # Reverse a list.
@@ -34,7 +34,7 @@ def reverse(list):
 #
 def getattrlist(list, name):
        for item in list:
-               if item and is_list(item) and item[0] = name:
+               if item and is_list(item) and item[0] == name:
                        return item[1:]
        return []
 
@@ -43,8 +43,8 @@ def getattrlist(list, name):
 #
 def getproplist(list, name):
        for item in list:
-               if item and is_list(item) and item[0] = 'prop':
-                       if len(item) > 1 and item[1] = name:
+               if item and is_list(item) and item[0] == 'prop':
+                       if len(item) > 1 and item[1] == name:
                                return item[2:]
        return []
 
@@ -53,7 +53,7 @@ def getproplist(list, name):
 #
 def is_endgroup(list):
        x = getproplist(list, 'end-of-group')
-       return (x and x[0] = '#t')
+       return (x and x[0] == '#t')
 
 
 # Neatly display an actuator definition given as S-expression
@@ -63,13 +63,13 @@ def show_actuator(prefix, a):
        for item in a:
                if not is_list(item):
                        print prefix, item
-               elif item and item[0] = 'al':
+               elif item and item[0] == 'al':
                        print prefix, 'Subactuator list:'
                        for a in item[1:]:
                                show_actuator(prefix + '    ', a)
-               elif len(item) = 2:
+               elif len(item) == 2:
                        print prefix, item[0], '=>', item[1]
-               elif len(item) = 3 and item[0] = 'prop':
+               elif len(item) == 3 and item[0] == 'prop':
                        print prefix, 'Prop', item[1], '=>',
                        print item[2]
                else:
@@ -82,13 +82,13 @@ def show_panel(prefix, p):
        for item in p:
                if not is_list(item):
                        print prefix, item
-               elif item and item[0] = 'al':
+               elif item and item[0] == 'al':
                        print prefix, 'Actuator list:'
                        for a in item[1:]:
                                show_actuator(prefix + '    ', a)
-               elif len(item) = 2:
+               elif len(item) == 2:
                        print prefix, item[0], '=>', item[1]
-               elif len(item) = 3 and item[0] = 'prop':
+               elif len(item) == 3 and item[0] == 'prop':
                        print prefix, 'Prop', item[1], '=>',
                        print item[2]
                else:
@@ -112,14 +112,14 @@ def dummy_callback(arg):
 #
 def assign_members(target, attrlist, exclist, prefix):
        for item in attrlist:
-               if is_list(item) and len(item) = 2 and item[0] not in exclist:
+               if is_list(item) and len(item) == 2 and item[0] not in exclist:
                        name, value = item[0], item[1]
                        ok = 1
                        if value[0] in '-0123456789':
                                value = eval(value)
-                       elif value[0] = '"':
+                       elif value[0] == '"':
                                value = value[1:-1]
-                       elif value = 'move-then-resize':
+                       elif value == 'move-then-resize':
                                # Strange default set by Panel Editor...
                                ok = 0
                        else:
@@ -148,7 +148,7 @@ def build_actuator(descr):
        else:
                actuatorname = ''
        type = descr[0]
-       if type[:4] = 'pnl_': type = type[4:]
+       if type[:4] == 'pnl_': type = type[4:]
        act = pnl.mkact(type)
        act.downfunc = act.activefunc = act.upfunc = dummy_callback
        #
@@ -158,9 +158,9 @@ def build_actuator(descr):
        #
        datalist = getattrlist(descr, 'data')
        prefix = ''
-       if type[-4:] = 'puck':
+       if type[-4:] == 'puck':
                prefix = 'puck_'
-       elif type = 'mouse':
+       elif type == 'mouse':
                prefix = 'mouse_'
        assign_members(act, datalist, [], prefix)
        #
index 9c9ee022750a5e64a76e1eaa6e135e268a48c1b2..1b069fa0752178a1b255d9435598704991d8fe5d 100755 (executable)
@@ -20,16 +20,16 @@ def tokenize_string(s):
                c = s[:1]
                if c in whitespace:
                        s = s[1:]
-               elif c = ';':
+               elif c == ';':
                        s = ''
-               elif c = '"':
+               elif c == '"':
                        n = len(s)
                        i = 1
                        while i < n:
                                c = s[i]
                                i = i+1
-                               if c = '"': break
-                               if c = '\\': i = i+1
+                               if c == '"': break
+                               if c == '\\': i = i+1
                        tokens.append(s[:i])
                        s = s[i:]
                elif c in operators:
@@ -78,9 +78,9 @@ def parse_expr(tokens):
        while 1:
                if not tokens:
                        raise syntax_error, 'missing ")"'
-               if tokens[0] = ')':
+               if tokens[0] == ')':
                        return expr, tokens[1:]
-               elif tokens[0] = '(':
+               elif tokens[0] == '(':
                        subexpr, tokens = parse_expr(tokens)
                        expr.append(subexpr)
                else:
index abac4c847c4f699e77a09a3006f07197933558dc..3a21904c18d36501c81f1e2f6aa3d7b616d39803 100644 (file)
@@ -39,9 +39,9 @@ def times(a, b):
        return res
 
 def power(a, n): # Raise polynomial a to the positive integral power n
-       if n = 0: return [1]
-       if n = 1: return a
-       if n/2*2 = n:
+       if n == 0: return [1]
+       if n == 1: return a
+       if n/2*2 == n:
                b = power(a, n/2)
                return times(b, b)
        return times(power(a, n-1), a)
index 9a2ccb0728eade02712cb4151e67f94aabae4ba3..fa72ecb9789096fc53d50c5579b832beb7e86db9 100644 (file)
@@ -10,8 +10,8 @@ import stat
 # (begins with '/').
 #
 def join(a, b):
-       if b[:1] = '/': return b
-       if a = '' or a[-1:] = '/': return a + b
+       if b[:1] == '/': return b
+       if a == '' or a[-1:] == '/': return a + b
        # Note: join('x', '') returns 'x/'; is this what we want?
        return a + '/' + b
 
@@ -27,7 +27,7 @@ def split(p):
        head, tail = '', ''
        for c in p:
                tail = tail + c
-               if c = '/':
+               if c == '/':
                        head, tail = head + tail, ''
        return head, tail
 
@@ -40,9 +40,9 @@ def split(p):
 def splitext(p):
        root, ext = '', ''
        for c in p:
-               if c = '/':
+               if c == '/':
                        root, ext = root + ext + c, ''
-               elif c = '.' or ext:
+               elif c == '.' or ext:
                        ext = ext + c
                else:
                        root = root + c
@@ -64,7 +64,7 @@ def commonprefix(m):
                for i in range(len(prefix)):
                        if prefix[:i+1] <> item[:i+1]:
                                prefix = prefix[:i]
-                               if i = 0: return ''
+                               if i == 0: return ''
                                break
        return prefix
 
@@ -122,8 +122,8 @@ def sameopenfile(fp1, fp2):
 # describing the same file?
 #
 def samestat(s1, s2):
-       return s1[stat.ST_INO] = s2[stat.ST_INO] and \
-               s1[stat.ST_DEV] = s2[stat.STD_DEV]
+       return s1[stat.ST_INO] == s2[stat.ST_INO] and \
+               s1[stat.ST_DEV] == s2[stat.STD_DEV]
 
 
 # Subroutine and global data used by ismount().
@@ -137,7 +137,7 @@ def _getmounts():
        lines = string.splitfields(data, '\n')
        for line in lines:
                words = string.split(line)
-               if len(words) >= 3 and words[1] = 'on':
+               if len(words) >= 3 and words[1] == 'on':
                        mounts.append(words[2])
        return mounts
 
index e7d2b8711267c8c639719a9665722f9e1ffd90d1..4a4530953dd617c632b70b5f050d754e7c60270c 100644 (file)
@@ -49,7 +49,7 @@ class scheduler:
                for i in range(len(q)):
                        qtime, qpri, qact, qarg = q[i]
                        if time < qtime: break
-                       if time = qtime and priority < qpri: break
+                       if time == qtime and priority < qpri: break
                else:
                        i = len(q)
                q.insert(i, event)
@@ -72,7 +72,7 @@ class scheduler:
        # Check whether the queue is empty.
        #
        def empty(self):
-               return len(self.queue) = 0
+               return len(self.queue) == 0
        #
        # Run: execute events until the queue is empty.
        #
index fee49659a700cf01e25e3fff5c5a702aa822bd11..3682b209663380c18e8921d0628a9114b71e2b4d 100644 (file)
@@ -36,22 +36,22 @@ S_IFLNK  = 0120000
 S_IFSOCK = 0140000
 
 def S_ISDIR(mode):
-       return S_IFMT(mode) = S_IFDIR
+       return S_IFMT(mode) == S_IFDIR
 
 def S_ISCHR(mode):
-       return S_IFMT(mode) = S_IFCHR
+       return S_IFMT(mode) == S_IFCHR
 
 def S_ISBLK(mode):
-       return S_IFMT(mode) = S_IFBLK
+       return S_IFMT(mode) == S_IFBLK
 
 def S_ISREG(mode):
-       return S_IFMT(mode) = S_IFREG
+       return S_IFMT(mode) == S_IFREG
 
 def S_ISFIFO(mode):
-       return S_IFMT(mode) = S_IFIFO
+       return S_IFMT(mode) == S_IFIFO
 
 def S_ISLNK(mode):
-       return S_IFMT(mode) = S_IFLNK
+       return S_IFMT(mode) == S_IFLNK
 
 def S_ISSOCK(mode):
-       return S_IFMT(mode) = S_IFSOCK
+       return S_IFMT(mode) == S_IFSOCK
index 36ecc962d413699656a4dad820a19434fcc98bbd..bf13eb5add83c6aa2e2942d12cf74d4d8d05715a 100644 (file)
@@ -44,7 +44,7 @@ def forget(path):
 def forget_prefix(prefix):
        n = len(prefix)
        for path in cache.keys():
-               if path[:n] = prefix:
+               if path[:n] == prefix:
                        del cache[path]
 
 
@@ -52,16 +52,16 @@ def forget_prefix(prefix):
 # entries in subdirectories.
 #
 def forget_dir(prefix):
-       if prefix[-1:] = '/' and prefix <> '/':
+       if prefix[-1:] == '/' and prefix <> '/':
                prefix = prefix[:-1]
        forget(prefix)
        if prefix[-1:] <> '/':
                prefix = prefix + '/'
        n = len(prefix)
        for path in cache.keys():
-               if path[:n] = prefix:
+               if path[:n] == prefix:
                        rest = path[n:]
-                       if rest[-1:] = '/': rest = rest[:-1]
+                       if rest[-1:] == '/': rest = rest[:-1]
                        if '/' not in rest:
                                del cache[path]
 
index 949e128e5cc61995444e692b67c94a88fd2bd4d6..d1435d3acfbc9b55f5e97a1a1ed88e0f122718ab 100755 (executable)
@@ -110,7 +110,7 @@ class LabelAppearance:
        #
        def draw(self, (d, area)):
                area = _rect.intersect(area, self.bounds)
-               if area = _rect.empty:
+               if area == _rect.empty:
                        return
                d.cliprect(area)
                self.drawit(d)
index 5c57d9023e85a57e4fe00469f12861da8477c754..90d137e6fcb0f510486affb6282e90ba0a14c5c1 100755 (executable)
@@ -43,7 +43,7 @@ class CSplit(Split):
                # XXX One day Python will have automatic conversions...
                n = len(self.children)
                fn = float(n)
-               if n = 0: return
+               if n == 0: return
                (left, top), (right, bottom) = bounds
                width, height = right-left, bottom-top
                child_width, child_height = width*3/(n+4), height*3/(n+4)
index 20a0fe8bb70ef6cb62684bee2f4ff03b690f6015..0066c58fe9987057eb2d87e9b6281f6bb0665e9d 100755 (executable)
@@ -25,7 +25,7 @@ class DirList(VSplit):
                        if path.isdir(path.join(dirname, name)):
                                fullname = path.join(dirname, name)
                                btn = SubdirButton().definetext(self, fullname)
-                       elif name[-3:] = '.py':
+                       elif name[-3:] == '.py':
                                btn = ModuleButton().definetext(self, name)
                        else:
                                btn = FileButton().definetext(self, name)
index b169d726e2ef3e9e40c50965b953e0c732598177..aacfa9896909d791613fc08f4af42e2158b480a4 100755 (executable)
@@ -116,7 +116,7 @@ class Split:
                if not self.keybd_focus:
                        self.set_keybd_focus(self.keybd_interest[0])
                type, detail = type_detail
-               if type = WE_COMMAND and detail = WC_TAB and \
+               if type == WE_COMMAND and detail == WC_TAB and \
                                        len(self.keybd_interest) > 1:
                        self.next_keybd_focus()
                        return
@@ -144,9 +144,9 @@ class Split:
                        self.timer_interest.remove(child)
                if child in self.altdraw_interest:
                        self.altdraw_interest.remove(child)
-               if child = self.mouse_focus:
+               if child == self.mouse_focus:
                        self.mouse_focus = None
-               if child = self.keybd_focus:
+               if child == self.keybd_focus:
                        self.keybd_focus = None
        #
        def need_mouse(self, child):
@@ -154,7 +154,7 @@ class Split:
                        self.mouse_interest.append(child)
                        self.parent.need_mouse(self)
        def no_mouse(self, child):
-               if child = self.mouse_focus:
+               if child == self.mouse_focus:
                        self.mouse_focus = None
                if child in self.mouse_interest:
                        self.mouse_interest.remove(child)
@@ -168,7 +168,7 @@ class Split:
                if not self.keybd_focus:
                        self.set_keybd_focus(child)
        def no_keybd(self, child):
-               if child = self.keybd_focus:
+               if child == self.keybd_focus:
                        self.keybd_focus = None # Don't call child.deactivate()
                if child in self.keybd_interest:
                        self.keybd_interest.remove(child)
index d58f835ce750cf29aba2bbb18b60377ff92b2701..5bce412069ef387c7a754a7abcfd0db5ed7b17d7 100755 (executable)
@@ -51,7 +51,7 @@ class StripChart(LabelAppearance, NoReactivity):
        #
        def draw(self, (d, area)):
                area = rect.intersect(area, self.bounds)
-               if area = rect.empty:
+               if area == rect.empty:
                        return
                d.cliprect(area)
                d.erase(self.bounds)
index a0593c5f234a59cdb5f9d77c66d096e0f9b900cf..697ed07b74c8824b44ddb5e9e7ace4971b5f90a8 100755 (executable)
@@ -149,26 +149,26 @@ class WindowParent(ManageOneChild):
        # Only call dispatch once we are realized
        #
        def dispatch(self, (type, win, detail)):
-               if type = WE_DRAW:
+               if type == WE_DRAW:
                        d = self.win.begindrawing()
                        self.child.draw(d, detail)
                        del d
                        if self.do_altdraw: self.child.altdraw(detail)
-               elif type = WE_MOUSE_DOWN:
+               elif type == WE_MOUSE_DOWN:
                        if self.do_mouse: self.child.mouse_down(detail)
-               elif type = WE_MOUSE_MOVE:
+               elif type == WE_MOUSE_MOVE:
                        if self.do_mouse: self.child.mouse_move(detail)
-               elif type = WE_MOUSE_UP:
+               elif type == WE_MOUSE_UP:
                        if self.do_mouse: self.child.mouse_up(detail)
                elif type in (WE_CHAR, WE_COMMAND):
                        if self.do_keybd: self.child.keybd(type, detail)
-               elif type = WE_TIMER:
+               elif type == WE_TIMER:
                        if self.do_timer: self.child.timer()
-               elif type = WE_SIZE:
+               elif type == WE_SIZE:
                        self.fixup()
-               elif type = WE_CLOSE:
+               elif type == WE_CLOSE:
                        self.close_trigger()
-               elif type = WE_MENU:
+               elif type == WE_MENU:
                        self.menu_trigger(detail)
                if self.pending_destroy:
                        self.destroy()
index 912531752d484ba4ccbe4c1c16bd61f4e0fba697..67c3afbe22c2e1e6840eac11f1e7919d5d0f3d52 100755 (executable)
@@ -21,7 +21,7 @@ def delayfunc(msecs):
        #
        # Use millisleep for very short delays or if there are no windows
        #
-       if msecs < 100 or mainloop.countwindows() = 0:
+       if msecs < 100 or mainloop.countwindows() == 0:
                if msecs > 0:
                        time.millisleep(msecs)
                return
@@ -46,7 +46,7 @@ cancel = q.cancel
 # Emptiness check must check both queues
 #
 def empty():
-       return q.empty() and mainloop.countwindows() = 0
+       return q.empty() and mainloop.countwindows() == 0
 
 # Run until there is nothing left to do
 #
index d0a852503697d73e521aea81402c3aa5b345b7ab..beb522292127a48e15b4c911e764d0d07dc3b654 100755 (executable)
@@ -10,7 +10,7 @@ import dircache
 
 def action(w, string, i, detail):
        (h, v), clicks, button, mask = detail
-       if clicks = 2:
+       if clicks == 2:
                name = path.join(w.name, string)
                try:
                        w2 = anywin.open(name)
index aea7deb6e5e7b6baa1e055c28c4c1325e3a6bed6..b2d4add7e0a4e0355e41ba09fe78f1e9a18eb703 100755 (executable)
@@ -175,20 +175,20 @@ def test():
        winsize = w.getwinsize()
        while 1:
                type, window, detail = stdwinq.getevent()
-               if type = WE_CLOSE:
+               if type == WE_CLOSE:
                        break
-               elif type = WE_SIZE:
+               elif type == WE_SIZE:
                        newsize = w.getwinsize()
                        if newsize <> winsize:
                                w.change((0,0), winsize)
                                winsize = newsize
                                w.change((0,0), winsize)
-               elif type = WE_MOUSE_DOWN:
+               elif type == WE_MOUSE_DOWN:
                        stage = (stage + 1) % len(stages)
                        justify, center, title = stages[stage]
                        w.settitle(title)
                        w.change((0, 0), (1000, 1000))
-               elif type = WE_DRAW:
+               elif type == WE_DRAW:
                        width, height = winsize
                        f = formatter().init(w.begindrawing(), 0, 0, width)
                        f.center = center
@@ -198,7 +198,7 @@ def test():
                        for font in font1, font2, font1:
                                f.setfont(font)
                                for word in words:
-                                       space = 1 + (word[-1:] = '.')
+                                       space = 1 + (word[-1:] == '.')
                                        f.addword(word, space)
                                        if center and space > 1:
                                                f.flush()
index c2ec11f9270f6a2411fa6c2f56f5952f937ebc03..12ed90bba010edb3934c1b1a647dcbb9f5d04bd5 100755 (executable)
@@ -49,44 +49,44 @@ def mainloop():                             # Handle events until no windows left
 
 def treatevent(e):                     # Handle a stdwin event
        type, w, detail = e
-       if type = WE_DRAW:
+       if type == WE_DRAW:
                w.draw(w, detail)
-       elif type = WE_MENU:
+       elif type == WE_MENU:
                m, item = detail
                m.action[item](w, m, item)
-       elif type = WE_COMMAND:
+       elif type == WE_COMMAND:
                treatcommand(w, detail)
-       elif type = WE_CHAR:
+       elif type == WE_CHAR:
                w.char(w, detail)
-       elif type = WE_MOUSE_DOWN:
+       elif type == WE_MOUSE_DOWN:
                if detail[1] > 1: w.m2down(w, detail)
                else: w.mdown(w, detail)
-       elif type = WE_MOUSE_MOVE:
+       elif type == WE_MOUSE_MOVE:
                w.mmove(w, detail)
-       elif type = WE_MOUSE_UP:
+       elif type == WE_MOUSE_UP:
                if detail[1] > 1: w.m2up(w, detail)
                else: w.mup(w, detail)
-       elif type = WE_SIZE:
+       elif type == WE_SIZE:
                w.size(w, w.getwinsize())
-       elif type = WE_ACTIVATE:
+       elif type == WE_ACTIVATE:
                w.activate(w)
-       elif type = WE_DEACTIVATE:
+       elif type == WE_DEACTIVATE:
                w.deactivate(w)
-       elif type = WE_MOVE:
+       elif type == WE_MOVE:
                w.move(w)
-       elif type = WE_TIMER:
+       elif type == WE_TIMER:
                w.timer(w)
-       elif type = WE_CLOSE:
+       elif type == WE_CLOSE:
                w.close(w)
 
 def treatcommand(w, type):             # Handle a we_command event
-       if type = WC_CLOSE:
+       if type == WC_CLOSE:
                w.close(w)
-       elif type = WC_RETURN:
+       elif type == WC_RETURN:
                w.enter(w)
-       elif type = WC_TAB:
+       elif type == WC_TAB:
                w.tab(w)
-       elif type = WC_BACKSPACE:
+       elif type == WC_BACKSPACE:
                w.backspace(w)
        elif type in (WC_LEFT, WC_UP, WC_RIGHT, WC_DOWN):
                w.arrow(w, type)
@@ -101,13 +101,13 @@ def close(w):                             # Close method
                        break
 
 def arrow(w, detail):                  # Arrow key method
-       if detail = WC_LEFT:
+       if detail == WC_LEFT:
                w.kleft(w)
-       elif detail = WC_UP:
+       elif detail == WC_UP:
                w.kup(w)
-       elif detail = WC_RIGHT:
+       elif detail == WC_RIGHT:
                w.kright(w)
-       elif detail = WC_DOWN:
+       elif detail == WC_DOWN:
                w.kdown(w)
 
 
index f9ab90761ff036976816475a73fcf47565b7896e..eba161d6f357718bb7f65e0196859847fea92e91 100755 (executable)
@@ -164,13 +164,13 @@ def whichcol(w, h): # Return column number (may be >= len(w.data))
        return len(w.data)
 
 def arrow(w, type):
-       if type = WC_LEFT:
+       if type == WC_LEFT:
                incr = -1, 0
-       elif type = WC_UP:
+       elif type == WC_UP:
                incr = 0, -1
-       elif type = WC_RIGHT:
+       elif type == WC_RIGHT:
                incr = 1, 0
-       elif type = WC_DOWN:
+       elif type == WC_DOWN:
                incr = 0, 1
        else:
                return
index 1c45ab3b865bf8e8cb2b3d3c65438d3709168b4f..141204810504872ffa8198bcff2b6670bba92f63 100644 (file)
@@ -56,7 +56,7 @@ def split(s):
        i, n = 0, len(s)
        while i < n:
                while i < n and s[i] in whitespace: i = i+1
-               if i = n: break
+               if i == n: break
                j = i
                while j < n and s[j] not in whitespace: j = j+1
                res.append(s[i:j])
@@ -71,7 +71,7 @@ def splitfields(s, sep):
        nsep = len(sep)
        i = j = 0
        while j+nsep <= ns:
-               if s[j:j+nsep] = sep:
+               if s[j:j+nsep] == sep:
                        res.append(s[i:j])
                        i = j = j + nsep
                else:
@@ -98,7 +98,7 @@ index_error = 'substring not found in string.index'
 def index(s, sub):
        n = len(sub)
        for i in range(len(s) + 1 - n):
-               if sub = s[i:i+n]: return i
+               if sub == s[i:i+n]: return i
        raise index_error, (s, sub)
 
 # Convert string to integer
@@ -137,7 +137,7 @@ def center(s, width):
 # Decadent feature: the argument may be a string or a number
 # (Use of this is deprecated; it should be a string as with ljust c.s.)
 def zfill(x, width):
-       if type(x) = type(''): s = x
+       if type(x) == type(''): s = x
        else: s = `x`
        n = len(s)
        if n >= width: return s
index 1c45ab3b865bf8e8cb2b3d3c65438d3709168b4f..141204810504872ffa8198bcff2b6670bba92f63 100644 (file)
@@ -56,7 +56,7 @@ def split(s):
        i, n = 0, len(s)
        while i < n:
                while i < n and s[i] in whitespace: i = i+1
-               if i = n: break
+               if i == n: break
                j = i
                while j < n and s[j] not in whitespace: j = j+1
                res.append(s[i:j])
@@ -71,7 +71,7 @@ def splitfields(s, sep):
        nsep = len(sep)
        i = j = 0
        while j+nsep <= ns:
-               if s[j:j+nsep] = sep:
+               if s[j:j+nsep] == sep:
                        res.append(s[i:j])
                        i = j = j + nsep
                else:
@@ -98,7 +98,7 @@ index_error = 'substring not found in string.index'
 def index(s, sub):
        n = len(sub)
        for i in range(len(s) + 1 - n):
-               if sub = s[i:i+n]: return i
+               if sub == s[i:i+n]: return i
        raise index_error, (s, sub)
 
 # Convert string to integer
@@ -137,7 +137,7 @@ def center(s, width):
 # Decadent feature: the argument may be a string or a number
 # (Use of this is deprecated; it should be a string as with ljust c.s.)
 def zfill(x, width):
-       if type(x) = type(''): s = x
+       if type(x) == type(''): s = x
        else: s = `x`
        n = len(s)
        if n >= width: return s
index 92a6203e8a1639d7f633fc7321c2be8d7fa60dd6..b6e5047198ce0d9fbeba87ee581658c579096f0b 100644 (file)
@@ -44,7 +44,7 @@ def gethdr(fp):
 def printhdr(file):
        hdr = gethdr(open(file, 'r'))
        data_size, encoding, sample_rate, channels, info = hdr
-       while info[-1:] = '\0':
+       while info[-1:] == '\0':
                info = info[:-1]
        print 'File name:  ', file
        print 'Data size:  ', data_size
index ec631049ecc3032db96a4d8e45c5807621e3788e..ef0c4b50d235b20780de0b4b55aad8051d7a84ca 100644 (file)
--- a/Lib/tb.py
+++ b/Lib/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
index 753e066116e3f573f061bc395050b972c4b60bdc..5f4a9dc69ea208a7857632d8cb02c1e3d0cee789 100644 (file)
@@ -40,9 +40,13 @@ if 0xff <> 255: raise TestFailed, 'hex number'
 if 0377 <> 255: raise TestFailed, 'octal number'
 x = 3.14
 x = 0.314
+x = .14
+x = 3.
 x = 3e14
 x = 3E14
 x = 3e-14
+x = 3.e14
+x = .14e3
 x = 0L
 x = 0l
 x = 0xffffffffffffffffL
@@ -209,11 +213,11 @@ print 'test' # and_test ('or' and_test)*
 ### comparison: expr (comp_op expr)*
 ### comp_op: '<'|'>'|'='|'>' '='|'<' '='|'<' '>'|'in'|'not' 'in'|'is'|'is' 'not'
 if 1: pass
-if 1 = 1: pass
-if 1 < 1 > 1 = 1 >= 1 <= 1 <> 1 in 1 not in 1 is 1 is not 1: pass
-if not 1 = 1 = 1: pass
-if not 1 = 1 and 1 and 1: pass
-if 1 and 1 or 1 and 1 and 1 or not 1 = 1 = 1 and 1: pass
+if 1 == 1: pass
+if 1 < 1 > 1 == 1 >= 1 <= 1 <> 1 in 1 not in 1 is 1 is not 1: pass
+if not 1 == 1 == 1: pass
+if not 1 == 1 and 1 and 1: pass
+if 1 and 1 or 1 and 1 and 1 or not 1 == 1 == 1 and 1: pass
 
 print 'expr' # term (('+'|'-') term)*
 x = 1
@@ -236,17 +240,34 @@ x = 1
 c = sys.path[0]
 x = time.time()
 x = sys.modules['time'].time()
-a = '01234'
-c = a[0]
-c = a[0:5]
-c = a[:5]
-c = a[0:]
-c = a[:]
-c = a[-5:]
-c = a[:-1]
-c = a[-4:-3]
-
-print 'atom' # '(' [testlist] ')' | '[' [testlist] ']' | '{' '}' | '`' testlist '`' | NAME | NUMBER | STRING
+for a in '01234', (0,1,2,3,4), [0,1,2,3,4]:
+       c = a[0]
+       c = a[-1]
+       c = a[0:5]
+       c = a[:5]
+       c = a[0:]
+       c = a[:]
+       c = a[-5:]
+       c = a[:-1]
+       c = a[-4:-3]
+a = [0,1,2,3,4]
+del a[0]
+a = [0,1,2,3,4]
+del a[-1]
+a = [0,1,2,3,4]
+del a[1:2]
+a = [0,1,2,3,4]
+del a[:1]
+a = [0,1,2,3,4]
+del a[-1:]
+a = [0,1,2,3,4]
+a[0] = 0
+a[-1] = 4
+a[1:2] = [1]
+a[1:4] = [0]
+a[1:-1] = [1,2,3]
+
+print 'atom' # '(' [tetslist] ')' | '[' [testlist] ']' | '{' '}' | '`' testlist '`' | NAME | NUMBER | STRING
 x = (1)
 x = (1 or 2 or 3)
 x = (1 or 2 or 3, 2, 3)
@@ -476,7 +497,7 @@ import string
 reload(string)
 
 print 'type'
-if type('') <> type('123') or type('') = type(()):
+if type('') <> type('123') or type('') == type(()):
        raise TestFailed, 'type()'
 
 
index d7f06db1eb035b1ba23e3a04f12956f2e4dcb7aa..4f03626390390d907dbb2cd00cc295b7a92ac2f8 100644 (file)
@@ -53,7 +53,7 @@ def make_all(mat):
        return all
 
 def make_elements(n, d):
-       if d = 0: return [poly.one(0, 0)]
+       if d == 0: return [poly.one(0, 0)]
        sub = make_elements(n, d-1)
        all = []
        for a in sub:
@@ -75,7 +75,7 @@ def checkfield(n, p):
        inv1 = inv[:]
        all1.sort()
        inv1.sort()
-       if all1 = inv1: print 'BINGO!'
+       if all1 == inv1: print 'BINGO!'
        else:
                print 'Sorry:', n, p
                print all
index 47b673cf39a93c284fffa8d79b1511539d6b8bd3..725f10ea99106469a702b32628aaed897d074b3a 100644 (file)
@@ -37,17 +37,17 @@ def _stat(name):
                cache[name] = NONE
                return NONE
        cache[name] = list
-       if name[-1:] = ':': cache[name[:-1]] = list
+       if name[-1:] == ':': cache[name[:-1]] = list
        else: cache[name+':'] = list
        return list
 
 def isdir(name):
        st = _stat(name)
-       return type(st) = LISTTYPE
+       return type(st) == LISTTYPE
 
 def isfile(name):
        st = _stat(name)
-       return st = FILE
+       return st == FILE
 
 def exists(name):
        st = _stat(name)
@@ -55,7 +55,7 @@ def exists(name):
 
 def listdir(name):
        st = _stat(name)
-       if type(st) = LISTTYPE:
+       if type(st) == LISTTYPE:
                return st
        else:
                raise RuntimeError, 'list non-directory'
index 06f7559e05ae09233facbf43d5a70f32737a0c74..c0aea702ecba6dfe642199af8b5bb7360b0cf7da 100755 (executable)
@@ -17,13 +17,13 @@ except NameError:
        statfunc = posix.stat
 
 # Parse options
-if sys.argv[1] = '-m':
+if sys.argv[1] == '-m':
        itime = ST_MTIME
        del sys.argv[1]
-elif sys.argv[1] = '-c':
+elif sys.argv[1] == '-c':
        itime = ST_CTIME
        del sys.argv[1]
-elif sys.argv[1] = '-a':
+elif sys.argv[1] == '-a':
        itime = ST_CTIME
        del sys.argv[1]
 else:
index 152fb1d2b66c60be282847678027004d3aa73eab..54396a309146b33400e4377567c437e6b9fcacd4 100755 (executable)
@@ -10,9 +10,9 @@ def main():
        silent = 0
        verbose = 0
        if sys.argv[1:]:
-               if sys.argv[1] = '-v':
+               if sys.argv[1] == '-v':
                        verbose = 1
-               elif sys.argv[1] = '-s':
+               elif sys.argv[1] == '-s':
                        silent = 1
        MAGIC = '\0\0\0\0'
        try:
@@ -32,7 +32,7 @@ def main():
                        print 'Checking', `dirname`, '...'
                names.sort()
                for name in names:
-                       if name[-3:] = '.py':
+                       if name[-3:] == '.py':
                                name = path.join(dirname, name)
                                try:
                                        st = posix.stat(name)
@@ -55,7 +55,7 @@ def main():
                                        print `name_c`
                                        continue
                                mtime = get_long(mtime_str)
-                               if mtime = 0 or mtime = -1:
+                               if mtime == 0 or mtime == -1:
                                        print 'Bad ".pyc" file', `name_c`
                                elif mtime <> st[ST_MTIME]:
                                        print 'Out-of-date ".pyc" file',
index 93985149650bdb445c4e4d5c955cd19393af3705..a8051c1edd00a550b0da46731d04f81932d163f5 100755 (executable)
@@ -17,7 +17,7 @@ def visit(pattern, dirname, names):
                name = path.join(dirname, name)
                try:
                        linkto = posix.readlink(name)
-                       if linkto[:n] = pattern:
+                       if linkto[:n] == pattern:
                                print name, '->', linkto
                except posix.error:
                        pass
index b45bba2ae30cafe6981fbd7b5e4c24353e6609dc..a21797d6ff38b7339d8efd6b0c67697e1521f85f 100755 (executable)
@@ -170,18 +170,18 @@ def main():
                return 1
        optu = optc = optd = 0
        for opt, void in optlist:
-               if opt = '-u':
+               if opt == '-u':
                        optu = 1
-               elif opt = '-c':
+               elif opt == '-c':
                        optc = 1
-               elif opt = '-d':
+               elif opt == '-d':
                        optd = 1
-       if optu = optc = optd = 0:
+       if optu == optc == optd == 0:
                optu = optc = optd = 1
        if not args:
                args = ['-']
        for file in args:
-               if file = '-':
+               if file == '-':
                        readinput(sys.stdin)
                else:
                        readinput(open(file, 'r'))
index 2533015de182c25607dcfa3501ef03bb49f88b35..df20894019ff709ae00574cfd1d069ea22b4e80e 100755 (executable)
@@ -67,13 +67,13 @@ m_from = regexp.compile('^[ \t]*import[ \t]+([^#]+)')
 def process(filename, table):
        fp = open(filename, 'r')
        mod = path.basename(filename)
-       if mod[-3:] = '.py':
+       if mod[-3:] == '.py':
                mod = mod[:-3]
        table[mod] = list = []
        while 1:
                line = fp.readline()
                if not line: break
-               while line[-1:] = '\\':
+               while line[-1:] == '\\':
                        nextline = fp.readline()
                        if not nextline: break
                        line = line[:-1] + nextline
index b3a693e230167efaaed633cb5d5cc01b87ebde1f..fdf7bd1dc48b19b154fde09919a25fd5d5dbd921 100755 (executable)
@@ -33,7 +33,7 @@ def treat_file(file):
                print 'Cannot open', file
                return
        base = path.basename(file)
-       if base[-3:] = '.py': base = base[:-3]
+       if base[-3:] == '.py': base = base[:-3]
        s = base + '\t' + file + '\t' + '1\n'
        tags.append(s)
        while 1:
index 7fda113650e1bd54d67f64bf92971a9378809e35..a92557c264ec9f13011993e6dd7d31ae4aecd566 100755 (executable)
@@ -22,7 +22,7 @@ def main():
 def getsuffix(file):
        suff = ''
        for i in range(len(file)):
-               if file[i] = '.':
+               if file[i] == '.':
                        suff = file[i:]
        return suff
 
index b36c5cae5ee8256e707bab99d0f9d18bb8d32245..24071f4747de0c7b159999cd4a140e2ca4a9a878 100755 (executable)
@@ -23,7 +23,7 @@ for prog in sys.argv[1:]:
                                mode = S_IMODE(st[ST_MODE])
                                if mode % 2 or mode/8 % 2 or mode/64 % 2:
                                        if ident:
-                                               if st[:3] = ident:
+                                               if st[:3] == ident:
                                                        s = ': same as '
                                                else:
                                                        s = ': also '
index ef4ff11d9b2a01073447697003646a1025c097c5..27bb71de088f8672a10ce12b472545509817c6e4 100755 (executable)
@@ -50,19 +50,19 @@ def skipfile(file):
        # Skip executables
        try:
                data = open(file, 'r').read(len(EXECMAGIC))
-               if data = EXECMAGIC: return 1
+               if data == EXECMAGIC: return 1
        except:
                pass
        return 0
 
 def badprefix(file):
        for bad in badprefixes:
-               if file[:len(bad)] = bad: return 1
+               if file[:len(bad)] == bad: return 1
        return 0
 
 def badsuffix(file):
        for bad in badsuffixes:
-               if file[-len(bad):] = bad: return 1
+               if file[-len(bad):] == bad: return 1
        return 0
 
 def go(args):