[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gnulib-tool.py: Remove a redundant function.
From: |
Collin Funk |
Subject: |
Re: gnulib-tool.py: Remove a redundant function. |
Date: |
Mon, 15 Apr 2024 08:24:35 -0700 |
User-agent: |
Mozilla Thunderbird |
Hi Bruno,
On 4/15/24 7:58 AM, Bruno Haible wrote:
> Patch 0002 is not applicable because it relies on 0001, which was not good.
Yes, I need to rewrite it. But I think the idea of the patch is still
correct. Since it doesn't make sense to accept a list and then only
use it with one element lists.
> Also, the last hunk makes use of yet another Python built-in function 'zip',
> where list comprehension [ ... for ... in ... ] is more readable.
Maybe I am missing something, but I don't think there is a good way to
use a list comprehension here without 'zip'. Since 'zip' is used to
combine these two lists like so:
list1 = [ 1, 2, 3, 4 ]
list2 = [ 5, 6, 7, 8 ]
result = list(zip(list1, list2))
print(result)
[(1, 5), (2, 6), (3, 7), (4, 8)]
This still uses 'zip' but maybe you find it easier to read?
result = [ (a, b) for
a, b in zip(list1, list2) ]
> 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.
Ah, yes that makes sense. I'll go fix that now.
Collin
- gnulib-tool.py: Remove a redundant function., Collin Funk, 2024/04/14
- Re: gnulib-tool.py: Remove a redundant function., Collin Funk, 2024/04/14
- Re: gnulib-tool.py: Remove a redundant function., Bruno Haible, 2024/04/15
- Re: gnulib-tool.py: Remove a redundant function.,
Collin Funk <=
- Re: gnulib-tool.py: Remove a redundant function., Bruno Haible, 2024/04/16
- Re: gnulib-tool.py: Remove a redundant function., Collin Funk, 2024/04/16
- Refactoring rewrite_filename functions, Collin Funk, 2024/04/16
- Re: Refactoring rewrite_filename functions, Bruno Haible, 2024/04/16
- Re: Refactoring rewrite_filename functions, Collin Funk, 2024/04/16
- Re: Refactoring rewrite_filename functions, Bruno Haible, 2024/04/17
Re: gnulib-tool.py: Remove a redundant function., Bruno Haible, 2024/04/15