bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org, Collin Funk <collin.funk1@gmail.com>
Subject: Re: gnulib-tool.py: Remove a redundant function.
Date: Tue, 16 Apr 2024 17:09:57 +0200	[thread overview]
Message-ID: <6055935.ntHmXhgcp8@nimes> (raw)
In-Reply-To: <77cae641-4960-48ea-adf5-6ef28edb658d@gmail.com>

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





  reply	other threads:[~2024-04-16 15:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-15  1:23 gnulib-tool.py: Remove a redundant function Collin Funk
2024-04-15  2:20 ` Collin Funk
2024-04-15 14:58   ` Bruno Haible
2024-04-15 15:24     ` Collin Funk
2024-04-16 15:09       ` Bruno Haible [this message]
2024-04-16 16:23         ` Collin Funk
2024-04-17  1:12         ` Refactoring rewrite_filename functions Collin Funk
2024-04-17  1:35           ` Bruno Haible
2024-04-17  2:08             ` Collin Funk
2024-04-17 14:03               ` Bruno Haible
2024-04-15 11:47 ` gnulib-tool.py: Remove a redundant function Bruno Haible
2024-04-15 14:07   ` Collin Funk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6055935.ntHmXhgcp8@nimes \
    --to=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    --cc=collin.funk1@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).