[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
- Re: gnulib-tool.py: Fix 'consider-using-with' pylint warnings., (continued)
- Re: gnulib-tool.py: Fix 'consider-using-with' pylint warnings., Collin Funk, 2024/04/05
- Re: gnulib-tool.py: lists vs. sets, Bruno Haible, 2024/04/06
- Re: gnulib-tool.py: lists vs. sets, Collin Funk, 2024/04/06
- Re: gnulib-tool.py: lists vs. sets, Bruno Haible, 2024/04/07
- Re: gnulib-tool.py: lists vs. sets, Collin Funk, 2024/04/07
- Re: Python list micro-benchmarks, Bruno Haible, 2024/04/07
- Re: Python list micro-benchmarks, Collin Funk, 2024/04/07
- Re: Python list micro-benchmarks, Paul Eggert, 2024/04/07
- Re: Python list micro-benchmarks, Collin Funk, 2024/04/07
- Re: Python list micro-benchmarks, Bruno Haible, 2024/04/08
- Re: Python list micro-benchmarks,
Collin Funk <=
- Re: Python list micro-benchmarks, Bruno Haible, 2024/04/08
- Re: Python list micro-benchmarks, Paul Eggert, 2024/04/08
- Re: Python list micro-benchmarks, Collin Funk, 2024/04/08
- gnulib-tool.py: Prefer 'list.append(item)' over 'list += [item]'., Collin Funk, 2024/04/08
- Re: gnulib-tool.py: Prefer 'list.append(item)' over 'list += [item]'., Bruno Haible, 2024/04/08
- Re: gnulib-tool.py: Prefer 'list.append(item)' over 'list += [item]'., Collin Funk, 2024/04/08