summaryrefslogtreecommitdiffstats
path: root/Lib/threading.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2013-03-10 22:13:35 (GMT)
committerRaymond Hettinger <python@rcn.com>2013-03-10 22:13:35 (GMT)
commit720da571590427a10bbf04cdfe486f4ab6d85156 (patch)
tree4950506baded34ac6b55bec89aa043e64e832831 /Lib/threading.py
parentfc5c5320a0de0724d692e05b5f08aaed3fce03c8 (diff)
downloadcpython-720da571590427a10bbf04cdfe486f4ab6d85156.zip
cpython-720da571590427a10bbf04cdfe486f4ab6d85156.tar.gz
cpython-720da571590427a10bbf04cdfe486f4ab6d85156.tar.bz2
Update code to increment and decrement using the cleaner += 1 and -= 1 style.
Diffstat (limited to 'Lib/threading.py')
-rw-r--r--Lib/threading.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/threading.py b/Lib/threading.py
index 6c34d49..35d2e8a 100644
--- a/Lib/threading.py
+++ b/Lib/threading.py
@@ -79,7 +79,7 @@ class _RLock:
def acquire(self, blocking=True, timeout=-1):
me = get_ident()
if self._owner == me:
- self._count = self._count + 1
+ self._count += 1
return 1
rc = self._block.acquire(blocking, timeout)
if rc:
@@ -261,7 +261,7 @@ class Semaphore:
break
self._cond.wait(timeout)
else:
- self._value = self._value - 1
+ self._value -= 1
rc = True
self._cond.release()
return rc
@@ -270,7 +270,7 @@ class Semaphore:
def release(self):
self._cond.acquire()
- self._value = self._value + 1
+ self._value += 1
self._cond.notify()
self._cond.release()
@@ -506,7 +506,7 @@ class BrokenBarrierError(RuntimeError): pass
_counter = 0
def _newname(template="Thread-%d"):
global _counter
- _counter = _counter + 1
+ _counter += 1
return template % _counter
# Active thread administration