STINNER Victor added the comment:

For all reasons alread given in the previous comment and my comment below, I 
reject the proposed change.


Serhiy> See also issue26748. Classes usually have True boolean value, but empty 
enum classes were False-y by accident. This was considered a bug.

Another example: issue #13936, "RFE: change bool(datetime.time(0, 0, 0)) to 
evaluate as True". datetime.time was changed in Python 3.5 to always be true, 
especially for the time 00:00:00. It's the opposite of the proposed change for 
CompletedProcess.


The problem is also that different users can expect a different answer from 
bool(CompletedProcess): non-zero return code, non-empty stdout, empty stderr, 
etc.

CompleteProcess is a complex object with many attributes, it's not as simple as 
a tuple or a string, where the truthness is obvious.


> Richard Neumann: "A useless use case is attached."

"if subprocess.run(...):"

Sorry, I'm not convinced that the need of breaking the backward compatibility 
for this "useless use case". It's trivial to split it in two lines:

"cmd = subprocess.run(...); if cmd.returncode: (...)"

By the way, it became common that I write such code, and in this case, I need 
the returncode value in the if block:

"cmd = subprocess.run(...); if cmd.returncode: sys.exit(cmd.returncode)".

So I need the CompletedProcess object anyway.

----------
resolution:  -> rejected
stage: needs patch -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25452>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to