Re:Local Variables as Accidental Breadcrumbs for Faster Debu...
by Terr_ on Friday October 11, 2024 @07:56PM
(#41815111)
I think the main times I ever argue to remove local variables, it occurs when they're being run together into a data-structure which would be easier to see at-a-glance, ex:
header = {"name": "Unknown"}
body = {"items": []}
footer = {"page": 0}
placeholder = {
"header": header
"body": body
"footer": footer
}
return(placeholder)
Right now the code is clear. After you’ve had your morning coffee, and read my PR description. How about at 5:05 when you’re trying to get to your kid’s soccer game and there’s a production issue? After I merge this you’re never going to look at this code again when there isn’t something else going on. A bug or a feature you’re trying to wedge into this code.