GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Add NewType by ilevkivskyi · Pull Request #226 · python/typing Conversation
|
|
@ilevkivskyi I know you're intent on maintaining the distinction between types and classes, so I think here "class" is the correct choice, no? EDIT: Actually, never mind. I was too focused on how they simulate instantiation. I think there's just something about the name From an introspection POV, an instance of a class with |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@JukkaL, what do you think of this design? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I am intentionally a bit "general" here, see my comment from the issue: Concerning your two other points, the idea here is to be really minimal, to allow minimum overhead. In particular your idea with many base classes is almost equivalent to |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Note, see my comment/concern I posted to the corresponding issue. I don't
think this is ripe yet...
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| NewType helper function | ||
| ----------------------- | ||
|
|
||
| There are also situations, where a programmer might want to avoid logical |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
No comma.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| * Generic, used to create user-defined generic classes | ||
|
|
||
| * Type, used to annotate class objects |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This and the next one I'll apply right now. They're unrelated to this issue.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
OK, sure, I just posted a link to this PR to python-dev asking for comments.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
A few things:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Good point. I added this in new commit
Here I am not sure. Maybe ad-hoc types? EDIT: replaced by the correct quote |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Let's think some more about the name, it feels important. Even if the
function is called NewType.
…--Guido (mobile)
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Appointed types — because they are only nominally distinct. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
TypeDef |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
I like @lgautier's How I would read it:
If
How I would read it:
NamedType works better, though. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I could not follow anything from the Scala ValueType description (no news The explanation "it is the same type with a different name" feels wrong -- I will check with Jukka but unless he has strong objections I am going for On Wed, Jun 1, 2016 at 1:42 AM, Sietse Brouwer [email protected]
--Guido van Rossum (python.org/~guido) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I'm going to abandon the "English description" discussion, and merge this as-is. The new function will be called NewType() and in the discussion we'll use "unique type" (like in this PR). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Mypy issue is here: python/mypy#1284 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.