[Python-checkins] cpython (3.4): asyncio.events: Use __slots__ in Handle and TimerHandle

larry.hastings python-checkins at python.org
Mon Mar 17 07:31:34 CET 2014


http://hg.python.org/cpython/rev/dcaa7a26eed3
changeset: 89706:dcaa7a26eed3
branch: 3.4
user: Yury Selivanov <yselivanov at sprymix.com>
date: Wed Feb 12 17:01:52 2014 -0500
summary:
 asyncio.events: Use __slots__ in Handle and TimerHandle
files:
 Lib/asyncio/events.py | 4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/Lib/asyncio/events.py b/Lib/asyncio/events.py
--- a/Lib/asyncio/events.py
+++ b/Lib/asyncio/events.py
@@ -19,6 +19,8 @@
 class Handle:
 """Object returned by callback registration methods."""
 
+ __slots__ = ['_callback', '_args', '_cancelled']
+
 def __init__(self, callback, args):
 assert not isinstance(callback, Handle), 'A Handle is not a callback'
 self._callback = callback
@@ -46,6 +48,8 @@
 class TimerHandle(Handle):
 """Object returned by timed callback registration methods."""
 
+ __slots__ = ['_when']
+
 def __init__(self, when, callback, args):
 assert when is not None
 super().__init__(callback, args)
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /