So to push back against my earlier self, chatgpt is hella impressive, just about philosophy. Which is not actually surprising because how could it be good by learning from human input?
But for technical stuff -- woah. E.g.,
me:
> Can you write me a python program that replaces all curly quotes in a text with straight quotes?
Chat-GPT:
import re
def replace_curly_quotes(text):
# Replace all instances of left curly quotes ( and ) with straight quotes (')
text = re.sub(r'[]', "'", text)
# Replace all instances of right curly quotes ( and ) with straight quotes (")
text = re.sub(r'[]', '"', text)
return text
# Test the function with a sample string
sample_string = "This is a test string with curly quotes: Hello, world!"
print(replace_curly_quotes(sample_string))
---
The comments are misleading because the two commands are about single vs. double quotes rather than left vs. right, but the code is correct (and I've tested it, too; it works).