[Python-Dev] Adding NewType() to PEP 484
Steven D'Aprano
steve at pearwood.info
Sat May 28 08:24:45 EDT 2016
On Fri, May 27, 2016 at 09:26:29PM -0700, Guido van Rossum wrote:
> We discussed this over dinner at PyCon, some ideas we came up with:
>
> - Dependent types, harking back to a similar concept in Ada
> (https://en.wikibooks.org/wiki/Ada_Programming/Type_System#Derived_types)
> which in that language is also spelled with "new".
I started to explain this to my non-programmer wife, I got as far as
explaining types, and that we need a name for this thing, and she
stopped me and said
"Please don't tell me this is leading to TypyMcTypeCheck."
[...]
> - BoatyMcBoatType
> The nice thing about "distinguished" is that it's a relatively rare
> word so it is easy to remember or look up.
I would have thought that being rare, it would be *harder* to remember.
> Personally I'm still in favor of Derived type (but I'm more into
> ancient programming languages than most folks here). I could also live
> with Distinguished Type.
I think Derived Type is the nicest of the options. It accurately
describes what it is: a type derived from another. And its shorter and
easy to both say and write than "Distinguished type" (which sounds like
"distinguished gentlemen" -- is it wearing a monocle and a top hat?).
"Distinguished" is too vague for my tastes, it might as well be
"flibblegubble type". *All* types are distinguished, the type checker
has to distinguish int from float from list from str, so to call
NewType("userid", int) a "distinguished type" is only to call it a type.
--
Steve
More information about the Python-Dev
mailing list