<div dir="auto"><div><div dir="auto"><div dir="auto"><div data-smartmail="gmail_signature" dir="auto">On Jul 23, 2017 1:56 PM, "MRAB" <<a href="mailto:python@mrabarnett.plus.com">python@mrabarnett.plus.com</a>> wrote:</div></div></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 2017-07-23 17:08, Todd wrote:<div class="elided-text"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
On Jul 20, 2017 1:13 AM, "David Mertz" <<a href="mailto:mertz@gnosis.cx" target="_blank">mertz@gnosis.cx</a> <mailto:<a href="mailto:mertz@gnosis.cx" target="_blank">mertz@gnosis.cx</a>>> wrote:<br>
<br>
    I'm concerned in the proposal about losing access to type<br>
    information (i.e. name) in this proposal.  For example, I might<br>
    write some code like this now:<br>
<br>
     >>> from collections import namedtuple<br>
     >>> Car = namedtuple("Car", "cost hp weight")<br>
     >>> Motorcycle = namedtuple("Motorcycle", "cost hp weight")<br>
     >>> smart = Car(18_900, 89, 949)<br>
     >>> harley = Motorcyle(18_900, 89, 949)<br>
     >>> if smart==harley and type(smart)==type(harley):<br>
    ...     print("These are identical vehicles")<br>
<br>
    The proposal to define this as:<br>
<br>
     >>> smart = (cost=18_900, hp=89, weight=949)<br>
     >>> harley = (cost=18_900, hp=89, weight=949)<br>
<br>
    Doesn't seem to leave any way to distinguish the objects of<br>
    different types that happen to have the same fields.  Comparing<br>
    `smart._fields==harley._fields<wbr>` doesn't help here, nor does any type<br>
    constructed solely from the fields.<br>
<br>
<br>
What about making a syntax to declare a type? The ones that come to mind are<br>
<br>
     name = (x=, y=)<br>
<br>
Or<br>
<br>
     name = (x=pass, y=pass)<br>
<br>
They may not be clear enough, though.<br>
<br>
</blockquote></div>
Guido has already declared that he doesn't like those bare forms, so it'll probably be something like ntuple(...).</blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">Not exactly a literal in that case.<div dir="auto"><br></div><div dir="auto"><span style="font-family:sans-serif">If this is true, why not simply add keyword arguments to tuple(...)?</span></div><div dir="auto"><br></div><div dir="auto">Something like (a=1, b=2, c=3) makes very clear sense to me, or even (1, 2, c=3), where the first two are accessible by index only. Or even (1, 2, c: 3), which reminds me of Elixir's expansion of tuple and list keywords.</div><div dir="auto"><br></div><div dir="auto">A tuple is a tuple is a tuple. No types. Just convenient accessors.</div><div dir="auto"><br></div><div dir="auto">-- </div><div dir="auto"><br></div><div dir="auto">C Anthony<br></div></div></div>