+1 from me, I've actually had several situations where I was in need of such notation. I also think that the proposed syntax in intuitive enough so that it should not cause any confusion.
On Wed, Oct 20, 2021 at 2:08 AM Steven D'Aprano <st...@pearwood.info> wrote: > On Sun, Oct 17, 2021 at 05:02:23PM -0700, Guido van Rossum wrote: > > On Sun, Oct 17, 2021 at 4:38 PM Steven D'Aprano <st...@pearwood.info> > wrote: > > > > > Right-o, the old "heterogeneous tuples versus homogeneous lists" > > > distinction, I remember that from the old 1.5 days. I haven't heard it > > > mentioned for a long time! > > > > > > > You must not have looked at type annotations then. :-) > > Not closely enough to draw the connection unprompted, no. Thanks for the > reminder. > > > Type annotations > > legitimize this, by favoring the syntax list[int] for a homogeneous list > > versus tuple[int, str, bool] for a heterogeneous tuple. (There's a syntax > > for a homogeneous tuple too, but it's intentionally slightly longer.) > > This makes sense. > > > > So this rule of thumb is definitely not dead (as you seemed to imply). > > What I actually said: > > "That certainly remains a reasonable guideline to make, albeit less so > today" > > (and then gave reasons why less so). > > I explicitly agreed that it still is a good distinction to make. It is a > particularly egregiously unfair misrepresentation to say I "seemed to > imply" otherwise. That's not cool. > > Another factor in favour of the heterogeneous vs homogeneous distinction > is the practical difficulty in working with complex data structures made > from tuples, due to their immutability. I've just spent some time using > an API that represents data as nested tuples, and due to their > immutability they can be a pain to assemble. Nested lists are much > easier. > > It's okay if you know your data up front and can write it as a nested > tuple display, but if you need to assemble it dynamically, it is not > fun. Would not recommend. > > Fortunately it's my own API and so I can take a flame thrower to it and > replace it with something better :-) > > > -- > Steve > _______________________________________________ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/M4DRP2WMNXMSOJXE72IOHV452LQSJ7WM/ > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/PVMMLJEAHCMVLLEEQRSK6U5CR2SDO2AK/ Code of Conduct: http://python.org/psf/codeofconduct/