News for hackers. Stuff that matters.
Re:Local Variables as Accidental Breadcrumbs for Faster Debu... by hinkley on Friday October 11, 2024 @01:32PM (#41811474)
I don’t ignore a lot of pull request comments but I ignore these with extreme prejudice. It isn’t making the code slower to assign intermediate values. You’re just playing the “fuck you, I’ve got mine” card if you insist the variables are unnecessary to understand the code. I’m leaving them in and if you have a problem with that then we have a problem.

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.

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)