<div dir="ltr"><div><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Honestly I would like to declare the bare (x=1, y=0) proposal dead. Let's encourage the use of objects rather than tuples (named or otherwise) for most data exchanges. I know of a large codebase that uses dicts instead of objects, and it's a mess. I expect the bare ntuple to encourage the same chaos.</div></blockquote><div><br></div><div>Languages since the original Pascal have had a way to define types by structure. If Python did the same, ntuples with the same structure would be typed "objects" that are not pre-declared.</div><div><br></div><div>In Python's case, because typing of fields is not required and thus can't be used to hint the structures type, the names and order of fields could be used. Synthesizing a (reserved) type name for (x=1, y=0) should be straight forward.</div><div><br></div><div>I short,</div><div><br></div><div>>>> isinstance(x=None, y=None), type((x=1, y=0)))</div></div><div>True</div><div><br></div><div>That can be implemented with namedtuple with some ingenious mangling for the (quasi-anonymous) type name.</div><div><br></div><div>Equivalence of types by structure is useful, and is very different from the mess that using dicts as records can produce.</div><div><br></div><div>Cheers,</div><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><span style="color:rgb(0,102,0)">Juancarlo </span><b style="color:rgb(0,102,0)">AƱez</b></div>
</div></div></div>