A little less verbose:
import typing.Annotated as A
def request(
method: A[str, "The method to perform"],
url: A[str, "The URL to submit request to"],
...
) -> Response:
"""Constructs and sends a request."""
...
On Fri, 2021-01-29 at 13:43 -0800, abed...@gmail.com wrote:
> *
*I was hoping for something a little less *verbose*
I left out the word "verbose". I'll tripple check my next post. Sorry again.
On Friday, January 29, 2021 at 3:41:17 PM UTC-6 abed...@gmail.com wrote:
> That could work. I'm not super familiar with typing.Annotated. I was
> hoping for something
That could work. I'm not super familiar with typing.Annotated. I was hoping
for something a little less though my example doesn't really show that with
the way used commas.
Thinking about it more, it should be possible for the parser to recognize a
comma followed by a comment within a function s
Or now, thinking more about it, why not simplify it by having a string
literal in Annotated just represent its docstring?
def request(
method: Annotated[str, "The method to perform"],
url: Annotated[str, "The URL to submit request to"],
...
) -> Response:
"""Constructs and sends a
Perhaps this would be a good opportunity to start looking at
typing.Annotated[...] as a mechanism for parameter documentation?
Something like:
def request(
method: Annotated[str, Doc("The method to perform")],
url: Annotated[str, Doc("The URL to submit request to")],
...
) -> Response:
Sorry, I accidentally hit "post message" too soon. The idea is that python
would somehow construct a more complete doc-string from the function
doc-string and it's signature/parameter doc-strings.
On Friday, January 29, 2021 at 2:29:51 PM UTC-6 abed...@gmail.com wrote:
> Currently, python allow