From ffdb8bb99c4017152a9dca70669f9d6b9831d454 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Mon, 27 Sep 2004 15:29:05 +0000 Subject: [PATCH] Use floor division operator. --- Lib/imaplib.py | 2 +- Lib/random.py | 4 ++-- Lib/test/test_deque.py | 2 +- Lib/test/test_enumerate.py | 2 +- Lib/test/test_itertools.py | 2 +- Lib/test/test_random.py | 2 +- Lib/test/test_set.py | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Lib/imaplib.py b/Lib/imaplib.py index f5481d768c5..6a747285b91 100644 --- a/Lib/imaplib.py +++ b/Lib/imaplib.py @@ -1361,7 +1361,7 @@ def Time2Internaldate(date_time): zone = -time.altzone else: zone = -time.timezone - return '"' + dt + " %+03d%02d" % divmod(zone/60, 60) + '"' + return '"' + dt + " %+03d%02d" % divmod(zone//60, 60) + '"' diff --git a/Lib/random.py b/Lib/random.py index f355eace5bd..0a02787d2e7 100644 --- a/Lib/random.py +++ b/Lib/random.py @@ -197,9 +197,9 @@ class Random(_random.Random): if istep != step: raise ValueError, "non-integer step for randrange()" if istep > 0: - n = (width + istep - 1) / istep + n = (width + istep - 1) // istep elif istep < 0: - n = (width + istep + 1) / istep + n = (width + istep + 1) // istep else: raise ValueError, "zero step for randrange()" diff --git a/Lib/test/test_deque.py b/Lib/test/test_deque.py index de775dc23c9..c0024acefe3 100644 --- a/Lib/test/test_deque.py +++ b/Lib/test/test_deque.py @@ -385,7 +385,7 @@ class E: def __iter__(self): return self def next(self): - 3/0 + 3 // 0 class S: 'Test immediate stop' diff --git a/Lib/test/test_enumerate.py b/Lib/test/test_enumerate.py index 200779fb987..18c2bb93966 100644 --- a/Lib/test/test_enumerate.py +++ b/Lib/test/test_enumerate.py @@ -50,7 +50,7 @@ class E: def __iter__(self): return self def next(self): - 3/0 + 3 // 0 class N: 'Iterator missing next()' diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py index 6ce758a99eb..6ae67854497 100644 --- a/Lib/test/test_itertools.py +++ b/Lib/test/test_itertools.py @@ -476,7 +476,7 @@ class E: def __iter__(self): return self def next(self): - 3/0 + 3 // 0 class S: 'Test immediate stop' diff --git a/Lib/test/test_random.py b/Lib/test/test_random.py index b8d0b5d993f..9c2e0d0d86d 100644 --- a/Lib/test/test_random.py +++ b/Lib/test/test_random.py @@ -79,7 +79,7 @@ class TestBasicOps(unittest.TestCase): def factorial(n): return reduce(int.__mul__, xrange(1, n), 1) for k in xrange(n): - expected = factorial(n) / factorial(n-k) + expected = factorial(n) // factorial(n-k) perms = {} for i in xrange(trials): perms[tuple(self.gen.sample(pop, k))] = None diff --git a/Lib/test/test_set.py b/Lib/test/test_set.py index a4cbfc5ade7..01dded64d5e 100644 --- a/Lib/test/test_set.py +++ b/Lib/test/test_set.py @@ -1241,7 +1241,7 @@ class E: def __iter__(self): return self def next(self): - 3/0 + 3 // 0 class S: 'Test immediate stop'