Terry J. Reedy <tjre...@udel.edu> added the comment:

To me, Raymond's flattening is a plausible replacement, especially ater a 
future speedup.  However, I would re-order the patterns to None, False, True, 
str(), int(), ..., _.  These independent conditions, other than _ (or else in 
the if chain), can be ordered for best reading and comprehension speed, and I 
think the above is an improvement.

Ordering for execution speed would instead start with the most frequently true 
conditions.  An advantage of match over 'if' is that patterns are apparently 
easier to re-order or otherwise automatically optimize.

I agree that replacement should only be done when there is significant 
improvement in reading and/or execution speed.  To avoid backport issues, they 
should best be preceded by a check for bug reports and especially PRs that will 
or do affect the same area of code.

The proposal for a general, +- global replacement has been and will be 
rejected. I think that this issue should therefore be closed, fairly soon, as 
such.

----------
nosy: +terry.reedy

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

Reply via email to