diff options
author | Collin Winter <collinw@gmail.com> | 2007-07-17 20:59:35 (GMT) |
---|---|---|
committer | Collin Winter <collinw@gmail.com> | 2007-07-17 20:59:35 (GMT) |
commit | 6f2df4d5e193d54244b0c2de91ef0ab1604b9243 (patch) | |
tree | 5e172400da7561eb4bb8fafc62c8cab511d74dad /Demo/curses | |
parent | a8c360ee76fb76902a2e2140fbb38d4b06b2d9fb (diff) | |
download | cpython-6f2df4d5e193d54244b0c2de91ef0ab1604b9243.zip cpython-6f2df4d5e193d54244b0c2de91ef0ab1604b9243.tar.gz cpython-6f2df4d5e193d54244b0c2de91ef0ab1604b9243.tar.bz2 |
Run 2to3 over the Demo/ directory to shut up parse errors from 2to3 about lingering print statements.
Diffstat (limited to 'Demo/curses')
-rwxr-xr-x | Demo/curses/life.py | 12 | ||||
-rwxr-xr-x | Demo/curses/repeat.py | 6 |
2 files changed, 9 insertions, 9 deletions
diff --git a/Demo/curses/life.py b/Demo/curses/life.py index a5bbed2..ec79f9e 100755 --- a/Demo/curses/life.py +++ b/Demo/curses/life.py @@ -63,14 +63,14 @@ class LifeBoard: def set(self, y, x): """Set a cell to the live state""" if x<0 or self.X<=x or y<0 or self.Y<=y: - raise ValueError, "Coordinates out of range %i,%i"% (y,x) + raise ValueError("Coordinates out of range %i,%i"% (y,x)) self.state[x,y] = 1 def toggle(self, y, x): """Toggle a cell's state between live and dead""" if x<0 or self.X<=x or y<0 or self.Y<=y: - raise ValueError, "Coordinates out of range %i,%i"% (y,x) - if self.state.has_key( (x,y) ): + raise ValueError("Coordinates out of range %i,%i"% (y,x)) + if (x,y) in self.state: del self.state[x,y] self.scr.addch(y+1, x+1, ' ') else: @@ -89,7 +89,7 @@ class LifeBoard: if not update_board: for i in range(0, M): for j in range(0, N): - if self.state.has_key( (i,j) ): + if (i,j) in self.state: self.scr.addch(j+1, i+1, self.char) else: self.scr.addch(j+1, i+1, ' ') @@ -102,10 +102,10 @@ class LifeBoard: L = range( max(0, i-1), min(M, i+2) ) for j in range(0, N): s = 0 - live = self.state.has_key( (i,j) ) + live = (i,j) in self.state for k in range( max(0, j-1), min(N, j+2) ): for l in L: - if self.state.has_key( (l,k) ): + if (l,k) in self.state: s += 1 s -= live if s == 3: diff --git a/Demo/curses/repeat.py b/Demo/curses/repeat.py index fa7daac..1083239 100755 --- a/Demo/curses/repeat.py +++ b/Demo/curses/repeat.py @@ -27,14 +27,14 @@ import curses def main(): if not sys.argv[1:]: - print __doc__ + print(__doc__) sys.exit(0) cmd = " ".join(sys.argv[1:]) p = os.popen(cmd, "r") text = p.read() sts = p.close() if sts: - print >>sys.stderr, "Exit code:", sts + print("Exit code:", sts, file=sys.stderr) sys.exit(sts) w = curses.initscr() try: @@ -50,7 +50,7 @@ def main(): text = p.read() sts = p.close() if sts: - print >>sys.stderr, "Exit code:", sts + print("Exit code:", sts, file=sys.stderr) sys.exit(sts) finally: curses.endwin() |