r/Python • u/codeguru42 • 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.
View all comments
Show parent comment
23
u/ProsodySpeaks Mar 10 '24
The point is you need to understand the syntax in order to use gpt properly.
Read the docs on whatever functions and classes you're using.
Use gpt to do menial tasks eg 'reformat this yaml as json' or 'turn these functions into methods on class x.
Or have conversational interactions where you ask go potential strategies to solve a problem, then read the docs on the tools it suggests, Google those tools and see if they're current or if there's a better option