Hi Bruno,

On 4/7/24 4:56 AM, Bruno Haible wrote:
> In my opinion, both are good ways to express the same thing.
> The second one is more expressive; but we all can store a 3-lines
> snippet of code in our short-term memory.

Yeah, it isn't bad. Just personal preference I guess. Two more lines
for me to make typos though. :)

> The interesting question here is: is table2 a possibly long list?
> If yes, then can we convert it to a set, without impairing the
> clarity of the code?

There are probably some places where it would make sense. The test
suite should help catch any divergence from gnulib-tool.sh's sorting
behavior.

Since gnulib-tool.py doesn't have a speed issue, I'll probably focus
more on being a code janitor and cleaning up a bit.

That reminds me, is there a reason why in many places there is
something like this:

     newtail = []
     for item in tail:
         newtail += [item]

instead of this?

     newtail = []
     for item in tail:
         newtail.append(item)

I like the second more, but I can't tell if it is another overly
strong personal preference of mine...

Not that we will notice this, but an interesting implementation
detail:

>>> import timeit
>>> timeit.timeit(stmt='var += ["a"]', setup='var = []', number=100000000)
6.761068544998125
>>> timeit.timeit(stmt='var.append("a")', setup='var = []', number=100000000)
1.7367604600003688

Collin

Reply via email to