[New-bugs-announce] [issue5998] Add __bool__ to threading.Event and multiprocessing.Event

Floris Bruynooghe report at bugs.python.org
Mon May 11 23:24:19 CEST 2009

New submission from Floris Bruynooghe <floris.bruynooghe at gmail.com>:

I think it would allow for more pythonic code if the threading.Event and
multiprocessing.Event classes had the __bool__ special attribute.  This
would allow doing "if e: ..." instead of "if e.is_set(): ...".

This could be backported to 2.x really easily by just replacing __bool__
to __nonzero__.

See also the thread starting here:

components: Library (Lib)
files: event.diff
keywords: patch
messages: 87587
nosy: flub
severity: normal
status: open
title: Add __bool__ to threading.Event and multiprocessing.Event
type: feature request
versions: Python 2.7, Python 3.2
Added file: http://bugs.python.org/file13959/event.diff

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list