Thanks for writing the draft! I left a bunch of inline comments here https://github.com/Michael0x2a/peps/pull/1. May main suggestion is to move from brainstorming-like doc to more PEP-like (more strict) document, and move all things we are not doing now to the "Rejected/postponed ideas" section.

Thanks! I'll look into making those changes later tonight.

Regarding the discussion about enums and exhaustiveness checks: the reason I decided to avoid discussing any form of exhaustiveness checking in draft was because I felt exhaustiveness checking really had more to do with the semantics of unions rather the anything related to literal types. That said, I agree that adding a section reiterating that enums should be treated as (approximately) the union of their values is a good idea -- and if that gives us a way of writing exhaustiveness checks via the "assert_never" technique, even better!

I'll add a section about that later tonight as well.

-- Michael


On Fri, Nov 23, 2018 at 1:31 PM Ran Benita <ran234@gmail.com> wrote:
On Fri, Nov 23, 2018 at 04:30:39PM +0000, Ivan Levkivskyi wrote:
> > Of course, I would prefer to keep using Enums. That would require the
> > type checker to consider `Status` similarly to
> > `Literal[Status.Started, Status.Finished]`.
>
> Yes, I think an enum should be equivalent to union of all its values. IIRC
> this is already required by PEP 484, but was never implemented.
> We cab re-emphasize it in this PEP.

Thanks for pointing that out. I hadn't noticed that this appears in
PEP484. The section "Support for singleton types in unions"[0] discusses
this issue and has a similar example at the end. I think treating an
Enum as (approximately) a union of singleton types is a good way to make
that example work.

[0] https://www.python.org/dev/peps/pep-0484/#support-for-singleton-types-in-unions

Ran
_______________________________________________
Typing-sig mailing list -- typing-sig@python.org
To unsubscribe send an email to typing-sig-leave@python.org
https://mail.python.org/mm3/mailman3/lists/typing-sig.python.org/