bug-gnulib
[Top][All Lists]
Advanced

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

Re: gnulib-tool.py: Remove a redundant function.


From: Bruno Haible
Subject: Re: gnulib-tool.py: Remove a redundant function.
Date: Mon, 15 Apr 2024 16:58:45 +0200

Hi Collin,

> Patch 0002 does this. GLTestDir also has this rewrite_files() function
> so I did the same there. Maybe it is worth making that a helper
> function or using a base class in the future.
> 
> Also, the set() and list() calls around zip(...) are important since
> zip() returns an iterator [1]. I've used whichever was most similar to
> the previous code.

Patch 0002 is not applicable because it relies on 0001, which was not good.

Also, the last hunk makes use of yet another Python built-in function 'zip',
where list comprehension [ ... for ... in ... ] is more readable.

> Patch 0003 removes a directories list that was unused. These are
> created in the loop below it as files are written.

In gnulib-tool.sh the directories are created ahead of the loop that
copies the files. Why? Because when we have to create 500 files in the
lib/ directory, it is faster to do 'if not isdir(dirname)' once than
500 times. This is also true in Python.

Bruno






reply via email to

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