Skip to content

Be more precise about types vs. classes #214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 6, 2016

Conversation

ilevkivskyi
Copy link
Member

Also remove the mention of issubclass in the description of Union, and add a note about this for other special constructs.

Update from python/typing
Also remove the mention of issubclass in the description of Union, and add a note about this for other special constructs.
``T1`` and any of its subtypes, ``T2`` and
any of its subtypes, and so on. In other words, values of all types
``T1``, ``T2``, etc., and their subtypes are acceptable for
an argument annotated by ``Union[T1, T2, ...]``.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We haven't defined "compatible" previously. Maybe you can avoid it and just use "supertype"? Or briefly define it here? (The IOW doesn't really do that IMO. :-)

@gvanrossum
Copy link
Member

Could you also review PEP 483? It's referenced from PEP 484 and while it isn't part of the standard it intends to explain the theory behind things without being so distracted by the mechanics of introducing typing into Python.

@ilevkivskyi
Copy link
Member Author

I included your proposed changes. I tried to make the definition of Union as simple as possible, so that I used supertype.

It is good that you mentioned PEP 483. Actually, I already started working on extending PEP 483 along the following lines:

  • explain type systems in simple but precise words
  • clarify classes vs types
  • explain shortly why gradual typing is a good solution for Python
  • extend the discussion of generic types
  • add an extensive explanation of variance of generic types

I think I could make a PR soon (probably next week).

@gvanrossum gvanrossum merged commit 6e824a1 into python:master May 6, 2016
@gvanrossum
Copy link
Member

Thank! I've merged this downstream (in the peps hg repo) too.

If you're going to edit PEP 483, the best approach may be to copy that here first and then to build on that. I'll do that now.

@gvanrossum
Copy link
Member

(Done, and for good measure I've added PEP 482 too.)

@ilevkivskyi
Copy link
Member Author

Thanks, indeed, it is a very good idea to have all the related PEPs here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants