Issue 27644: Expand documentation about type aliases and NewType in the typing module (original) (raw)

Created on 2016-07-28 17:29 by michael0x2a, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
document_newtype.patch michael0x2a,2016-07-28 17:29 review
document_newtype_rev2.patch michael0x2a,2016-07-29 21:09 review
Messages (7)
msg271572 - (view) Author: Michael Lee (michael0x2a) * Date: 2016-07-28 17:29
This is a patch to update the documentation on the typing module. It expands the section on type aliases and adds a section on [NewType][0]. Since support for NewType was [recently added][1] to mypy, it seemed like a prudent time to update the docs to describe this new feature. The section on type aliases was mainly expanded because the distinction between type aliases and NewType could be potentially confusing, so adding extra clarification seemed like a good idea. [0]: https://www.python.org/dev/peps/pep-0484/#newtype-helper-function [1]: https://github.com/python/mypy/pull/1939
msg271588 - (view) Author: Ivan Levkivskyi (levkivskyi) * (Python committer) Date: 2016-07-28 22:14
Added two small comments to the review.
msg271642 - (view) Author: Ivan Levkivskyi (levkivskyi) * (Python committer) Date: 2016-07-29 19:40
> Should I edit the patch to include a sentence or two describing this > distinction, just remove the word "almost", or do something else? I think the best way is to remove the "almost" and briefly explain that you cannot subclass types returned by NewType.
msg271648 - (view) Author: Michael Lee (michael0x2a) * Date: 2016-07-29 21:09
Ok, here's revision 2 of my patch, after applying the changes from the last round of feedback.
msg271650 - (view) Author: Ivan Levkivskyi (levkivskyi) * (Python committer) Date: 2016-07-29 21:25
I have only one optional comment on the second revision.
msg271655 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2016-07-29 22:40
Thanks! Should go live later today.
msg271656 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2016-07-29 22:42
Mercurial revs: fd0dce6d33e7, 15a35a8da24b, 4ecea1ea11bf, 4ecea1ea11bf.
History
Date User Action Args
2022-04-11 14:58:34 admin set github: 71831
2016-07-29 22:42:45 gvanrossum set messages: +
2016-07-29 22:40:21 gvanrossum set status: open -> closedresolution: fixedmessages: +
2016-07-29 21:25:54 levkivskyi set nosy: + gvanrossummessages: +
2016-07-29 21:09:27 michael0x2a set files: + document_newtype_rev2.patchmessages: +
2016-07-29 19:40:40 levkivskyi set messages: +
2016-07-28 22:14:08 levkivskyi set messages: +
2016-07-28 22:12:17 levkivskyi set nosy: + levkivskyi
2016-07-28 17:29:04 michael0x2a create