On 02/12/2014 02:02 PM, yury.selivanov wrote: > http://hg.python.org/cpython/rev/920304e1f36b > changeset: 89175:920304e1f36b > 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) Apologies up front if these are stupid questions, but: Why __slots__? Are we going to have so many of these things that memory is an issue? The asserts in the code -- those are not for checking user input, correct? -- ~Ethan~
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4