[New-bugs-announce] [issue25452] Add __bool__() method to subprocess.CompletedProcess

Richard Neumann report at bugs.python.org
Wed Oct 21 12:50:58 CEST 2015


New submission from Richard Neumann:

The class subprocess.CompletedProcess is currently lacking a __bool__() method.

It might be a practical feature to have the possibility to evaluate a CompletedProcess instance in an if/else block without the necessity to handle the exception raised by CompletedProcess.check_returncode().

Hence, I suggest adding the method

def __bool__(self):
    return self.returncode == 0

to the class.

----------
components: Library (Lib)
messages: 253282
nosy: conqp
priority: normal
severity: normal
status: open
title: Add __bool__() method to subprocess.CompletedProcess
type: enhancement
versions: Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25452>
_______________________________________


More information about the New-bugs-announce mailing list