Gregory P. Smith <g...@krypto.org> added the comment:

My concern with this as an API change is if anyone is returning or passing a 
CompletedProcess instance around it may well be used in a context where None is 
a potential value.  Existing code in that situation would ordinarily be doing a 
bare `if cp:` test on it to check for None.

I don't ordinarily see code that passes a CompletedProcess instance around... 
but it seems like an annoying potentially breaking change to make for a very 
small added value.

`if cp.returncode:` is very explicit about its intent when read or written.  

`if cp:` is not, and could even be misread by someone unaware of the API to 
assume that cp is a number most likely the returncode itself and misunderstand 
that as "the returncode was non-zero" when it really means the opposite.

If we had done this on day one of the run() -> CompletedProcess API this 
would've been a fine choice.  But changing it now doesn't seem like a good idea 
to me.

----------
versions:  -Python 3.9

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

Reply via email to