bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnulib-tool.py: Prefer 'list.append(item)' over 'list += [item]'.


From: Collin Funk
Subject: gnulib-tool.py: Prefer 'list.append(item)' over 'list += [item]'.
Date: Mon, 8 Apr 2024 17:09:15 -0700
User-agent: Mozilla Thunderbird

Hi Bruno,

On 4/8/24 2:19 PM, Bruno Haible wrote:
> My experience is that ChatGPT (3.5) provides good answers for things that
> have a lot of mentions on the web. Whereas for things that are rarely
> mentioned, it starts to hallucinate and often provides wrong answers.
> Therefore, for routine questions around Python or C++, it is perfectly
> suited. Whereas for expert questions or things that require logical
> reasoning, you better do a fact-checking on the answer.

Ah, okay yes that makes sense and seems to match what I have seen in
my little experience using it.

I had a Bioinformatics professor who wanted to scare us away from
using ChatGPT on homework/exams. He asked it a somewhat unique, as in
not easily found online, but interesting question about nucleotide
triplets that create stop codons [1]. I can't remember the exact
question, but ChatGPT would give very obviously incorrect answers and
insist it was correct if you mentioned it.

>> Sounds good. What do you think about two patches to normalize the
>> existing code with the conventions we've agreed upon:
>>
>>      1. Convert '+= [item]' to '.append(item)'
> 

Patch 0001.

>>      2. Use single quotes for string literals.

Patch 0002.

> OK in places where the strings don't contain single-quotes. In class
> GLEmiter, in particular, there are many strings that contain commands
> in shell syntax, and these often contain single-quotes. Here, choose
> the style that best avoids backslashing.

Sounds good. In that case you have the option of double-quotes, raw
strings (r'...'), or three quotes ('''...'''). Since each of those has
their own upsides and limitations I have only changed double-quotes
which do not have an effect on backslashing if changed.

Also I ran all the tests successfully with Python 3.7 + 3.12 just to
make sure I didn't miss anything strange.

[1] 
https://en.wikipedia.org/wiki/DNA_and_RNA_codon_tables#Standard_RNA_codon_table

Collin

Attachment: 0001-gnulib-tool.py-Prefer-list.append-item-over-list-ite.patch
Description: Text Data

Attachment: 0002-gnulib-tool.py-Use-single-quotes-for-strings.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]