qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel <qemu-devel@nongnu.org>, Michael Roth <michael.roth@amd.com>
Subject: Re: [PATCH v4 0/6] qapi: static typing conversion, pt5c
Date: Tue, 21 Feb 2023 12:32:23 -0500	[thread overview]
Message-ID: <CAFn=p-ac9ufp8-cohrSfHc4A2OTQLbbGP6dAJ5Wy1X0Ua3Y5_Q@mail.gmail.com> (raw)
In-Reply-To: <87sfezzfh4.fsf@pond.sub.org>

[-- Attachment #1: Type: text/plain, Size: 2239 bytes --]

On Tue, Feb 21, 2023, 1:42 AM Markus Armbruster <armbru@redhat.com> wrote:

> John Snow <jsnow@redhat.com> writes:
>
> > On Wed, Feb 15, 2023 at 8:39 AM Markus Armbruster <armbru@redhat.com>
> wrote:
> >>
> >> I had a few suggestions, but none of them requires a respin.  Let's
> >> discuss them, and then I merge.
> >
> > Hiya, I lost track of things a little due to the other Python
> > discussion. Who is waiting for whom?
>
> Just two questions remain:
>
> * PATCH 3: Dumb down check_keys() argument all the way to List[str]?
>

Kinda prefer not to, but maybe I'm being too precious. (I have some more
exploratory patches that do use tuples here instead, but admit it's not
crucial.)

From a pure typing perspective, I wish I could leave it as it is now,
because I prefer to type input types as loosely as possible: claim only the
minimum power we need, instead of enforcing the specificity we happen to
have.

With the bug for 3.6 that is forcing me to use a more specific type anyway,
maybe you're right and I should just use List[] until I'm allowed to have
my proper abstraction.

OK, before I go further, lemme say that you can change it to List[] if you
want. I won't be too precious about it. (You can rewrite the patch in
question if you don't want to wait 24h.)

But, a question about typing strategy:

As a python tooling maintainer, should I push people to type as flexible as
possible or as *specific* as possible in general?

Flexible: (e.g. Sequence or Iterable)
- More likely to get along with other code
- More "pythonic", abstractly
- Less useful as documentation; if a function always happens to get a list,
is it annoying to pretend it's merely a sequence?

Specific: (e.g. List)
- Most useful as documentation
- Can assert greater knowledge of all callers
- More power afforded to function ("room to grow"?)
- More likely to require non-local edits when changing functionality or
refactoring
- More likely to require "casts" at callsites to convert data types

I think I lean towards the flexible/broad typing strategy in general, but
lament it cannot be applied appropriately here today.


> * PATCH 4: Suggested commit message addition okay?
>

Yes, ACK.


> We settle them, and then I'll take it from there.
>
>

[-- Attachment #2: Type: text/html, Size: 3835 bytes --]

  reply	other threads:[~2023-02-21 17:33 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-15  0:00 [PATCH v4 0/6] qapi: static typing conversion, pt5c John Snow
2023-02-15  0:00 ` [PATCH v4 1/6] qapi: Update flake8 config John Snow
2023-02-15  0:00 ` [PATCH v4 2/6] qapi: update pylint configuration John Snow
2023-02-15  0:00 ` [PATCH v4 3/6] qapi: Add minor typing workaround for 3.6 John Snow
2023-02-15  7:15   ` Markus Armbruster
2023-02-15 13:36     ` Markus Armbruster
2023-02-15 14:46       ` John Snow
2023-02-15  0:00 ` [PATCH v4 4/6] qapi/parser: add QAPIExpression type John Snow
2023-02-15  9:43   ` Markus Armbruster
2023-02-15 19:05     ` John Snow
2023-02-15  0:00 ` [PATCH v4 5/6] qapi: remove _JSONObject John Snow
2023-02-15  9:44   ` Markus Armbruster
2023-02-15  0:00 ` [PATCH v4 6/6] qapi: remove JSON value FIXME John Snow
2023-02-15 11:13   ` Markus Armbruster
2023-02-15 13:39 ` [PATCH v4 0/6] qapi: static typing conversion, pt5c Markus Armbruster
2023-02-21  1:26   ` John Snow
2023-02-21  6:42     ` Markus Armbruster
2023-02-21 17:32       ` John Snow [this message]
2023-02-22  9:16         ` Markus Armbruster

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='CAFn=p-ac9ufp8-cohrSfHc4A2OTQLbbGP6dAJ5Wy1X0Ua3Y5_Q@mail.gmail.com' \
    --to=jsnow@redhat.com \
    --cc=armbru@redhat.com \
    --cc=michael.roth@amd.com \
    --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).