On Thu, Jun 27, 2019 at 9:13 AM Steven D'Aprano email@example.com wrote:
The only risk here is if your refactoring does something silly, such as reusing a variable which overrides assignment:
How would you propose to write this code without reusing a variable?
def frobnicate(data): stuff =  for datum in data: f = process_the(data) g = munge_result(f) stuff.append(g) return stuff
Under the proposal, we have no guarantee that each iteration through the
loop will give us a new
f to work with. Maybe yes, maybe no. Without
looking at the source code in
process_the() we have no way of knowing
f is being bound to a new object each time or some completely
different arbitrary action.
-- Keeping medicines from the bloodstreams of the sick; food from the bellies of the hungry; books from the hands of the uneducated; technology from the underdeveloped; and putting advocates of freedom in prisons. Intellectual property is to the 21st century what the slave trade was to the 16th.