r/Python • • Mar 10 '24

Discussion Github Copilot Lies to me

My first attempt to get some help from Github Copilot:

Me: write a match case statement in python to match the first character of a string is a semicolon

Copilot: Python doesn't have a built-in match or case statement like some other languages (e.g., JavaScript, Swift, Rust). However, you can achieve similar functionality using...

Strangely, it finally gave me an answer when I made a small change to my prompt:

Me: write a match statement in python to match the first character of a string is a semicolon

Copilot: Python 3.10 introduces the structural pattern matching in the form of the match statement. Here's how you can use it to check if the first character of a string is a semicolon:...

I almost gave up after the first response that was blatantly false. Fortunately I something that looks like reasonable syntax...but then I haven't tried it yet, so that might be a lie, too.

0 Upvotes

67 comments sorted by

View all comments

Show parent comments

-8

u/codeguru42 Mar 10 '24

The best way to use it is to help you learn about things you don't know about, then consult official documentation sources for the facts.

That's exactly what I was trying to do. I was looking for some syntax that I don't know off the top of my head. After further this dead end with Github Copilot, I tried more google foo. I found that match doesn't support structural pattern matching on a string like it does for a list or a tuple.

1

u/gahooa Mar 10 '24

For whatever it's worth:

  1. I use chatgpt4 (paid) for general questions like you were asking.

  2. I use copilot (paid) for code completion, usually once I've set the stage with code for it to go on.

1

u/codeguru42 Mar 10 '24

What is the reason that you use chatgpt4 instead of copilot chat?

2

u/Glitterbombastic Mar 10 '24

Not op but have found that gpt gives more in-depth answers which helps you to learn about topics you’re asking around. Mixed results from both for code completion. In any case they’re always a bit wrong - you still need to validate and draw from your knowledge to find the right answer.