Commit 6a0d0853 authored by Denis Bilenko's avatar Denis Bilenko

add __nonzero__ for Greenlet: now Greenlet is true when it was started even if...

add __nonzero__ for Greenlet: now Greenlet is true when it was started even if it was not switched to yet.
parent fe42d8c2
......@@ -141,9 +141,12 @@ class Greenlet(greenlet):
self._notifier = loop.callback()
self._start_event = loop.callback()
def __nonzero__(self):
return self._start_event.pending or greenlet.__nonzero__(self)
@property
def started(self):
return self._start_event.pending or bool(self)
return self._start_event.pending or greenlet.__nonzero__(self)
def ready(self):
"""Return true if and only if the greenlet has finished execution."""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment