
I'm following up on the post with the link to the doc because I just realized that your "hybrid" form is different from what I had imagined. In your hybrid form you write f: (int, int, int=42) -> int which is not what I had in mind when I proposed it (but maybe you didn't get it from my proposal!). The hybrid form above can only specify optional *positional* arguments, whereas I think it would be more useful if you could specify optional *keyword* arguments. So what I had thought of as "hybrid" is not even in your list! I meant to allow f: (int, int, kw: int = 42) -> int which in stub-style syntax would be f: (_0: int, _1: int, /, kw: int = 42) -> int I therefore have a new proposal, let's call it "Guido". :-) In my proposal you can use stub-style syntax but you can optionally prefix that with any number of bare types. The semantics are that if there is no '/' in the stub-style portion, one is inserted between the bare args and the stub-style args, and the bare args are translated into named args by giving them dummy names (or naming them all "_" if that part of the proposal is accepted). Both rules can be seen in action in my little example above. Separately, I am +0 on allowing multiple positional arguments to be named "_", but I don't want to make it a deal-breaker. (I am not worried that this will confuse users more than once.) Finally, I'd like to make sure that we all agree that where we write 'int', 'str' etc. in the examples, an *arbitrary* type should be allowed, e.g. 'list[T]' or 'int | str' or even '(int, int) -> str'. On Fri, Jun 18, 2021 at 9:58 PM Steven Troxler <steven.troxler@gmail.com> wrote:
Pradeep and I put together a doc outlining the various proposals we are aware of.
There's a table of examples comparing each proposal side-by-side, followed by a section with more details and discussion about each proposed syntax:
https://docs.google.com/document/d/11VkNk9N8whxS1SrBv2BNN1Csl5yeTlgG7WyLrCB5...
Using comments for discussion help _______________________________________________ Typing-sig mailing list -- typing-sig@python.org To unsubscribe send an email to typing-sig-leave@python.org https://mail.python.org/mailman3/lists/typing-sig.python.org/ Member address: guido@python.org
-- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-c...>