This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author veky
Recipients Mark Byrne, r.david.murray, rhettinger, serhiy.storchaka, veky, vstinner
Date 2017-09-12.05:22:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1505193758.83.0.827861379084.issue31417@psf.upfronthosting.co.za>
In-reply-to
Content
Sorry, this seems like a classical example of "When all you have is a hammer, everything looks like a nail. Then, when you learn of a screwdriver, you suddenly see half of these nails as screws, completely ignoring there are other tools besides those two."

In fact, enumerate is _not_ the good choice in most of those cases, as the comments show. One should use zip, another should use ordinary iteration because the index isn't needed at all, and yet another should probably stay as it is, since that way it's more obvious that we're transforming each item in place. [When LHS is consts[i] and right is const, it's not easy to see they refer to the same place.]

Even the fourth I would argue is more readable in the current form, for a similar reason: when you base the decision on words[i], and the decision is to del words[i:], it's obvious you delete "it and everything after". Not so much in the "refactored" code.

Please don't do such things. One of Python's great strengths, especially in stdlib, is code stability. The only reason we're able to get anything done is that we have (or at least used to have) a great policy referred to in https://bugs.python.org/issue31417#msg301879, so we don't lose ourselves in enormous bikeshedding about how to best use the enormous expressivity of Python to write the code that works perfectly fine in some slightly different way.
History
Date User Action Args
2017-09-12 05:22:38vekysetrecipients: + veky, rhettinger, vstinner, r.david.murray, serhiy.storchaka, Mark Byrne
2017-09-12 05:22:38vekysetmessageid: <1505193758.83.0.827861379084.issue31417@psf.upfronthosting.co.za>
2017-09-12 05:22:38vekylinkissue31417 messages
2017-09-12 05:22:37vekycreate