]> granicus.if.org Git - python/commitdiff
asyncio.events: Use __slots__ in Handle and TimerHandle
authorYury Selivanov <yselivanov@sprymix.com>
Wed, 12 Feb 2014 22:01:52 +0000 (17:01 -0500)
committerYury Selivanov <yselivanov@sprymix.com>
Wed, 12 Feb 2014 22:01:52 +0000 (17:01 -0500)
Lib/asyncio/events.py

index 4c0cbb091768bccd62f13c33e65d97f6c8e7ea8f..dd9e3fb42992df2e5fdf2157cc5532abb94de74f 100644 (file)
@@ -19,6 +19,8 @@ from .log import logger
 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 Handle:
 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)