From: Alberto Garcia <berto@igalia.com>
To: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org,
Eric Blake <eblake@redhat.com>, Kevin Wolf <kwolf@redhat.com>,
Hanna Czenczek <hreitz@redhat.com>,
Madeeha Javed <javed@igalia.com>
Subject: Re: [PATCH] scripts/qcow2-to-stdout.py: Add script to write qcow2 images to stdout
Date: Mon, 01 Jul 2024 15:42:09 +0200 [thread overview]
Message-ID: <w51a5j1b55a.fsf@igalia.com> (raw)
In-Reply-To: <CAAjaMXau1qvDrBGn1Kj4Z7g0rRGsp0x6n9hmyK_-SA2HFeZ0Pg@mail.gmail.com>
On Mon 01 Jul 2024 02:07:01 PM +03, Manos Pitsidianakis wrote:
>> and I'm not sure what benefits using pathlib brings in this case.
>
> implicit type requirement, argument value validations, path
> normalization etc.
Do you have a specific example? I don't see any difference in behavior
if I make input_file a pathlib.Path, I still need to check if the file
exists, etc., I don't see that this is validating anything.
>> with open(raw_file, 'wb'):
>> pass
>>
>> If so I don't see the benefit, I just need to create an empty file and
>> close it immediately.
>
> My only argument here is that it's "more pythonic" which I know is of
> little value and consequence :) Feel free to ignore! They were mere
> suggestions.
In general I would agree (that's why I'm opening files this way in other
parts of the script) but for this case I don't think it's worth it.
>> I'm not sure that I understand, why would I need to use a shell here?
>
> I must have meant capture_output=True, not shell=True, sorry for that
> 🤔. The explicit check=False says to the reader that this won't throw
> an exception so it's just for readability. The capture_output part is
> so that you can print the outputs if the return code is an error.
Ah I see.
I'll send a new version soon.
Thanks for the review,
Berto
prev parent reply other threads:[~2024-07-01 13:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-10 14:47 [PATCH] scripts/qcow2-to-stdout.py: Add script to write qcow2 images to stdout Alberto Garcia
2024-06-12 6:01 ` Manos Pitsidianakis
2024-06-12 9:21 ` Alberto Garcia
2024-06-12 11:25 ` Manos Pitsidianakis
2024-06-12 11:00 ` Manos Pitsidianakis
2024-07-01 8:56 ` Alberto Garcia
2024-07-01 11:07 ` Manos Pitsidianakis
2024-07-01 13:42 ` Alberto Garcia [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=w51a5j1b55a.fsf@igalia.com \
--to=berto@igalia.com \
--cc=eblake@redhat.com \
--cc=hreitz@redhat.com \
--cc=javed@igalia.com \
--cc=kwolf@redhat.com \
--cc=manos.pitsidianakis@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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 NNTP newsgroup(s).