bug-gnulib
[Top][All Lists]
Advanced

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

Re: Python list micro-benchmarks


From: Collin Funk
Subject: Re: Python list micro-benchmarks
Date: Mon, 8 Apr 2024 14:08:05 -0700
User-agent: Mozilla Thunderbird

On 4/8/24 7:23 AM, Bruno Haible wrote:
>   - It explains ChatGPT's failure: Probably there are more explanations
>     regarding += on strings, on the web, than regarding += on lists.
>     So ChatGPT used the "common" explanation, for strings, and then
>     substituted s/string/list/.

Interesting. I know very little about ChatGPT so that explanation
works for me. :)

> Thanks. Now I agree to converging on .append(..), because by my common
> measure "what is surprising to a naïve developer?" the '+= [item]'
> syntax has two negative scores:
>   - It's surprising that += is optimized differently than +.
>   - It's surprising that lists are optimized differently than strings.

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)'
     2. Use single quotes for string literals.

I noticed many string literals use double quotes ("...") yesterday.
These are from before we agreed upon using single quotes.

I think it would be nice to have everything in agreement, but I
figured it is best to ask first.

Collin



reply via email to

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