Author terry.reedy
Recipients Kshitiz17, brandtbucher, rhettinger, steven.daprano, terry.reedy, xtreak
Date 2021-06-04.20:54:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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.
Date User Action Args
2021-06-04 20:54:54terry.reedysetrecipients: + terry.reedy, rhettinger, steven.daprano, xtreak, brandtbucher, Kshitiz17
2021-06-04 20:54:54terry.reedysetmessageid: <>
2021-06-04 20:54:54terry.reedylinkissue44276 messages
2021-06-04 20:54:54terry.reedycreate