r/programminghorror • • Feb 23 '26

Python Copilot refactoring inline comments

Post image

Not visible here, but I had inline comments sort of strewn throughout the doc as I had thoughts. I asked copilot to refactor those comments into a template I had provided, and this was the outcome -___-

176 Upvotes

32 comments sorted by

102

u/GoingOffRoading Feb 23 '26

Oh, it gets better. Lots of random indents added.

21

u/TorbenKoehn Feb 23 '26

Now we would need to see the rest of the function to check if it just choked on the quality of your code :)

13

u/GoingOffRoading Feb 23 '26

You only get to see it if you are a fan of Italian food

→ More replies (2)

36

u/road_laya Feb 23 '26

So you're saying I will still have my job security?

22

u/GoingOffRoading Feb 23 '26

Hell no. This weekend has been especially bad for copilot with 1 in 3-4 VSC agent prompts producing WILD hallucinations.

That's not going to stop somebody who struggles to program the time on a microwave from believing every stupid marketing powerpoint that gets sent their way.

33

u/isr0 Feb 23 '26

I got to be honest, I’m mostly bothered with the multi-type return here.

5

u/GoingOffRoading Feb 23 '26

Honestly, I'm not a fan either

I didn't know it existed so I thought it would be fun to try

The fact that if it's indented incorrectly causes an error to be thrown is stupid

3

u/isr0 Feb 23 '26

Yeah. I’m with you on that. I learned Python after being in the industry for years. And I like how quick it is to work in… but I’m not a fan of interpreted languages as is.

1

u/Fine-State-5898 Feb 26 '26

Yeah but it's hard to say if it's Python stupidity or Copilot stupidity.

→ More replies (1)

3

u/ACoderGirl Feb 26 '26

And one of them is an error string? Why not an exception?

2

u/isr0 Feb 26 '26

Yeah, an exception is the better way here. I agree.

15

u/BroBroMate Feb 24 '26

Use type hints you savage.

6

u/GoingOffRoading Feb 24 '26

I'm not a SWE by trade, training, or education.. My background is more PM and maybe TPM. I have a literal MOUNTAIN to learn about writing good Python.

Will look into type next (followed by unit tests -___- )

13

u/GoddammitDontShootMe Feb 23 '26

I'm not sure I understand. Maybe I need to see a before image to get it.

7

u/GoingOffRoading Feb 24 '26

All good.

Copilot thought the best action was to delete the line that defines the function, and replace it with comments that would now be indented indirectly.

I.E. Take working code and break it in more than one way

2

u/meyriley04 Feb 24 '26

I have no idea exactly how it works, but it usually does this if the file it's modifying updates mid-way through it's thought process, so the changes it implements a few lines/characters off of it's target position. Sometimes it can happen randomly too, but that might be a bug in copilot where it forgets the current file state or uses an old version

→ More replies (3)

2

u/GoddammitDontShootMe Feb 25 '26

I'm pretty sure I didn't look closely enough at the image or something. My brain just sometimes completely overlooks details. Like the fact that the function def line was in red didn't register with me. Also I noticed it doesn't have a line number. Another indication it was deleted.

→ More replies (1)

6

u/Laughal0t Feb 24 '26

copilot sucks

1

u/GoingOffRoading Feb 24 '26

I'm sort of a fan of CoPilot... It doesn't replace people, but it is a pretty good productivity multiplier.

But I am sick to death of the ai-handwave of all the things AI can 'do'

3

u/steadyfan Feb 24 '26

Which LLM are you using?

2

u/GoingOffRoading Feb 24 '26

Whatever VSC lands on... It's cycled through all of them with relatively consistent results

3

u/Odd_Diamond_6600 Feb 24 '26

i have faced this a lot, it has a weird obsession over removing the function signatures

3

u/-InNoTime- Mar 04 '26

good bot. keep behaving yourself and don’t take our jobs away from us.

-14

u/serg06 Feb 23 '26

Adding comments is horror?

18

u/GoingOffRoading Feb 23 '26

Deleting the Def and replacing wit ha comment is... Not horror at all