[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: |
Tue, 16 Apr 2024 17:09:57 +0200 |
Hi Collin,
> 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.
Sure. This code structure comes from the fact that in the shell
implementation, the rewriting of file names is done through a 'sed' invocation,
and that is equally suited to a single file name or a list of file names.
> > 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:
I'm talking about this piece of code:
filetable = []
for src in filelist:
dest = self.rewrite_files([src])[-1]
filetable.append(tuple([dest, src]))
which can be written as
filetable = [ tuple([self.rewrite_filename(src), src])
for src in filelist ]
Bruno
- 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, 2024/04/15
- Re: gnulib-tool.py: Remove a redundant function.,
Bruno Haible <=
- 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