this post was submitted on 27 May 2025
1940 points (99.5% liked)

Programmer Humor

23531 readers
1685 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] sturger@sh.itjust.works 10 points 2 days ago (9 children)

Honest question: I haven't used AI much. Are there any AIs or IDEs that can reliably rename a variable across all instances in a medium sized Python project? I don't mean easy stuff that an editor can do (e.g. rename QQQ in all instances and get lucky that there are no conflicts). I mean be able to differentiate between local and/or library variables so it doesn't change them, only the correct versions.

[–] barsoap@lemm.ee 23 points 2 days ago

Not reliably, no. Python is too dynamic to do that kind of thing without solving general program equivalence which is undecidable.

Use a static language, problem solved.

[–] trolololol@lemmy.world 18 points 2 days ago

I'm going to laugh in Java, where this has always been possible and reliable. Not like ai reliable, but expert reliable. Because of static types.

[–] bitwolf@sh.itjust.works 13 points 2 days ago (1 children)

For the most part "Rename symbol" in VSCode will work well. But it's limited by scope.

[–] sturger@sh.itjust.works 4 points 2 days ago

Yeah, I'm looking for something that would understand the operation (? insert correct term here) of the language well enough to rename intelligently.

[–] lapping6596@lemmy.world 11 points 2 days ago (1 children)

I use pycharm for this and in general it does a great job. At work we've got some massive repos and it'll handle it fine.

The "find" tab shows where it'll make changes and you can click "don't change anything in this directory"

[–] isVeryLoud@lemmy.ca 2 points 2 days ago (1 children)

Yes, all of JetBrains' tools handle project-wide renames practically perfectly, even in weirder things like Angular projects where templates may reference variables.

Just be carerul when refactoring variable names in doc comments, I've seen some weird stuff happen there

[–] derpgon@programming.dev 10 points 2 days ago

IntelliJ IDEA, if it knows it is the same variable, it will rename it. Usually works in a non fucked up codebase that uses eval or some obscure constructs like saving a variable name into a variable as a string and dynamically invoking it.

[–] Irelephant@lemm.ee 6 points 2 days ago (1 children)
[–] SkaveRat@discuss.tchncs.de 4 points 2 days ago

that will catch too many false positives

[–] killabeezio@lemm.ee 5 points 2 days ago

Itellij is actually pretty good at this. Besides that, cursor or windsurf should be able to. I was using cursor for a while and when I needed to reactor something, it was pretty good at picking that up. It kept crashing on me though, so I am now trying windsurf and some other options. I am missing the auto complete features in cursor though as I would use this all the time to fill out boilerplate stuff as I write.

The one key difference in cursor and windsurf when compared to other products is that it will look at the entire context again for any changes or at least a little bit of it. You make a change, it looks if it needs to make changes elsewhere.

I still don't trust AI to do much though, but it's an excellent helper

[–] LeroyJenkins@lemmy.world 3 points 2 days ago

most IDEs are pretty decent at it if you configure them correctly. I used intelliJ and it knows the difference. use the refactor feature and it'll crawl references, not just rename all instances.

[–] pinball_wizard@lemmy.zip 2 points 2 days ago

Okay, I realize I'm that person, but for those interested:

tree, cat and sed get the job done nicely.

And... it's my nap time, now. Please keep the Internet working, while I'm napping. I have grown fond of parts of it. Goodnight.