From: Paul Koning <paulkoning@comcast.net>
To: Tom Tromey <tromey@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Minor doc fix for Python Type.fields
Date: Wed, 5 Nov 2025 14:21:36 -0500 [thread overview]
Message-ID: <BCC20B36-D079-4313-973D-900ABD23776B@comcast.net> (raw)
In-Reply-To: <87bjlg9u6t.fsf@tromey.com>
> On Nov 5, 2025, at 2:05 PM, Tom Tromey <tromey@adacore.com> wrote:
>
>>> * Documents that a new sequence is always returned I've intentionally
>>> not mentioned that it is currently a list, in case we want to change
>>> to a tuple someday.
>
> Paul> Why is it important to say that a new sequence is returned? It
> Paul> seems to me that someday we may want to return the same sequence
> Paul> if thisis called multiple times.
>
> Yeah, I guess it isn't needed always.
> Like if gdb ever returned a tuple, it could be memoized.
> I wonder if Python has some idiomatic way to say "this is guaranteed to
> either return a tuple or a new list"
>
> Or if we should just write 'new list' and commit gdb to not memoizing.
>
> Tom
My point is slightly different. No matter what sequence type is returned, for a given Type object the value of the sequence returned would be the same if you call that method twice, right? So if I do:
a = sometype.fields()
b = sometype.fields()
then a == b. The statement "new sequence" promises that "a is not b", i.e., a and b are not the same object. But I see no reason why that is a useful property, and whether a and b are lists or tuples, it would be reasonable for "a is b" to hold. (Reasonable though not required.)
paul
next prev parent reply other threads:[~2025-11-05 19:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-05 18:10 Tom Tromey
2025-11-05 18:29 ` Paul Koning
2025-11-05 19:05 ` Tom Tromey
2025-11-05 19:21 ` Paul Koning [this message]
2025-11-05 19:27 ` Tom Tromey
2025-11-05 19:30 ` Paul Koning
2025-11-05 19:30 ` Eli Zaretskii
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=BCC20B36-D079-4313-973D-900ABD23776B@comcast.net \
--to=paulkoning@comcast.net \
--cc=gdb-patches@sourceware.org \
--cc=tromey@adacore.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