A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/attachments/20160528/1acc7d3c/attachment.html below:

<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">I'm surprised that nobody has suggested UniqueType. ;)</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 28 May 2016 at 10:17, Ivan Levkivskyi <span dir="ltr"><<a href="mailto:levkivskyi@gmail.com" target="_blank">levkivskyi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">My final vote goes to "distinct type alias".<br>
But how should we call the function? NewType? Or should we change it to DistinctAlias or something?</p>
<p dir="ltr">--<br>
Ivan</p>
<div class="gmail_quote">28 Ð¢Ñ€Ð° 2016 19:14 "Guido van Rossum" <<a href="mailto:guido@python.org" target="_blank">guido@python.org</a>> Ð¿Ð¸ÑˆÐµ:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">Ohhhhh, another D-word! I really like distinct.<br>
<br>
On Sat, May 28, 2016 at 8:19 AM, Steve Dower <<a href="mailto:steve.dower@python.org" target="_blank">steve.dower@python.org</a>> wrote:<br>
> Did anyone suggest "distinct type alias"?<br>
><br>
> Regardless of what name, I'm fairly sure people will call it whatever the<br>
> function to create it is called. So if the function is<br>
> typings.distinguish_type(...), then distinguished will stick.<br>
><br>
> Top-posted from my Windows Phone<br>
> ________________________________<br>
> From: Guido van Rossum<br>
> Sent: â€Ž5/‎28/‎2016 7:38<br>
> To: Steven D'Aprano<br>
> Cc: Python-Dev<br>
> Subject: Re: [Python-Dev] Adding NewType() to PEP 484<br>
><br>
> Just to add to the list of options, Twitter also came up with<br>
><br>
> - invention<br>
><br>
> - DomainType<br>
><br>
> - TypedAlias<br>
><br>
> But seriously I think we should just decide between Derived Type and<br>
> Distinguished Type [Alias].<br>
><br>
> The latter comes from the idea that when you write e.g.<br>
><br>
> UserId = int<br>
><br>
> then UserId is a type alias (that's existing PEP 484 terminology) and<br>
> the type checker doesn't distinguish it from int -- you can use it in<br>
> places where you logically expect a UserId but to the type checker<br>
> those variables have the type int.<br>
><br>
> There is even a neat potential "origin story" that would explain why<br>
> we'd call it Distinguished Type Alias.<br>
><br>
> The story is about gradually converting a large code base to being<br>
> consistent: initially you make UserId a regular type alias and you<br>
> start putting it in your code incrementally, making sure it has no<br>
> mypy errors as you go (but this just treats it as an int). After days,<br>
> when you think you are done, you change UserId to a distinguished type<br>
> alias and then mypy will point out the places where you've missed<br>
> something or you're doing something questionable with user IDs.<br>
><br>
> And yes, in the wider context of subclassing, Derived Type is probably<br>
> confusing because a subclass is also called a derived class.<br>
><br>
><br>
> On Sat, May 28, 2016 at 5:24 AM, Steven D'Aprano <<a href="mailto:steve@pearwood.info" target="_blank">steve@pearwood.info</a>><br>
> wrote:<br>
>> On Fri, May 27, 2016 at 09:26:29PM -0700, Guido van Rossum wrote:<br>
>><br>
>>> We discussed this over dinner at PyCon, some ideas we came up with:<br>
>>><br>
>>> - Dependent types, harking back to a similar concept in Ada<br>
>>> (<a href="https://en.wikibooks.org/wiki/Ada_Programming/Type_System#Derived_types" rel="noreferrer" target="_blank">https://en.wikibooks.org/wiki/Ada_Programming/Type_System#Derived_types</a>)<br>
>>> which in that language is also spelled with "new".<br>
>><br>
>> I started to explain this to my non-programmer wife, I got as far as<br>
>> explaining types, and that we need a name for this thing, and she<br>
>> stopped me and said<br>
>><br>
>> "Please don't tell me this is leading to TypyMcTypeCheck."<br>
>><br>
>> [...]<br>
>>> - BoatyMcBoatType<br>
>><br>
>>> The nice thing about "distinguished" is that it's a relatively rare<br>
>>> word so it is easy to remember or look up.<br>
>><br>
>> I would have thought that being rare, it would be *harder* to remember.<br>
>><br>
>><br>
>>> Personally I'm still in favor of Derived type (but I'm more into<br>
>>> ancient programming languages than most folks here). I could also live<br>
>>> with Distinguished Type.<br>
>><br>
>> I think Derived Type is the nicest of the options. It accurately<br>
>> describes what it is: a type derived from another. And its shorter and<br>
>> easy to both say and write than "Distinguished type" (which sounds like<br>
>> "distinguished gentlemen" -- is it wearing a monocle and a top hat?).<br>
>><br>
>> "Distinguished" is too vague for my tastes, it might as well be<br>
>> "flibblegubble type". *All* types are distinguished, the type checker<br>
>> has to distinguish int from float from list from str, so to call<br>
>> NewType("userid", int) a "distinguished type" is only to call it a type.<br>
>><br>
>><br>
>><br>
>> --<br>
>> Steve<br>
>> _______________________________________________<br>
>> Python-Dev mailing list<br>
>> <a href="mailto:Python-Dev@python.org" target="_blank">Python-Dev@python.org</a><br>
>> <a href="https://mail.python.org/mailman/listinfo/python-dev" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br>
>> Unsubscribe:<br>
>> <a href="https://mail.python.org/mailman/options/python-dev/guido%40python.org" rel="noreferrer" target="_blank">https://mail.python.org/mailman/options/python-dev/guido%40python.org</a><br>
><br>
><br>
><br>
> --<br>
> --Guido van Rossum (<a href="http://python.org/~guido" rel="noreferrer" target="_blank">python.org/~guido</a>)<br>
> _______________________________________________<br>
> Python-Dev mailing list<br>
> <a href="mailto:Python-Dev@python.org" target="_blank">Python-Dev@python.org</a><br>
> <a href="https://mail.python.org/mailman/listinfo/python-dev" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br>
> Unsubscribe:<br>
> <a href="https://mail.python.org/mailman/options/python-dev/steve.dower%40python.org" rel="noreferrer" target="_blank">https://mail.python.org/mailman/options/python-dev/steve.dower%40python.org</a><br>
<br>
<br>
<br>
--<br>
--Guido van Rossum (<a href="http://python.org/~guido" rel="noreferrer" target="_blank">python.org/~guido</a>)<br>
_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org" target="_blank">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br></div></div>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/levkivskyi%40gmail.com" rel="noreferrer" target="_blank">https://mail.python.org/mailman/options/python-dev/levkivskyi%40gmail.com</a><br>
</blockquote></div>
<br>_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/pludemann%40google.com" rel="noreferrer" target="_blank">https://mail.python.org/mailman/options/python-dev/pludemann%40google.com</a><br>
<br></blockquote></div><br></div>

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4