[Python-ideas] Parameter documentation

2021-01-29 Thread abed...@gmail.com
Currently, python allows variable documentation via PEP 526 . For most functions with short parameter lists that can fit in a reasonable column limit, I prefer the traditional declaration style with Google-style doc strings: *def

[Python-ideas] Re: Parameter documentation

2021-01-29 Thread abed...@gmail.com
"""Constructs and sends a request.""" > > ... > > > > On Fri, 2021-01-29 at 20:40 +, Paul Bryan wrote: > > Perhaps this would be a good opportunity to start looking at > typing.Annotated[...] as a mechanism for parameter documenta

[Python-ideas] Re: Parameter documentation

2021-01-29 Thread abed...@gmail.com
*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 > hopi

[Python-ideas] Re: Parameter documentation

2021-01-29 Thread abed...@gmail.com
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: > Curr

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-02 Thread abed...@gmail.com
y not replace `def func(x=0)` with `def func(x=SENTINEL): if x is SENTINEL: x = 0`? I'm at a loss for ways to explain my position any clear than that. On Thursday, December 2, 2021 at 9:52:28 AM UTC-6 Steven D'Aprano wrote: > On Wed, Dec 01, 2021 at 09:00:50PM -0800, abed...@gmail.com wrote: > >

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-02 Thread abed...@gmail.com
Steven D'Aprano "> My favorite alternative is ?= if people think => and -> are getting > overly loaded. What I really don't like is @param=[] because it puts the > emphasis on the parameter name rather than the act of binding. Not only > does it make it look like @param is a special kind of

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-02 Thread abed...@gmail.com
Nicholas Cole "There is nothing that this proposal makes possible that is not already possible with more explicit code." There's nothing any of Python's syntax makes possible that is not already possible with Brainfuck or any other language that's Turing complete. The current hacks used to get

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-02 Thread abed...@gmail.com
other_default) -> ReturnType:# code goes here ...* On Thursday, December 2, 2021 at 5:56:36 PM UTC-6 abed...@gmail.com wrote: > If the coder's intent is to have an optional parameter default to an empty >> list, the most EXPLICIT way to encode that intent would be to have the >

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-02 Thread abed...@gmail.com
"The caller cannot explicitly ask for default behaviour except by omitting the parameter. This can be very annoying to set up when the parameter values are provided from other places, e.g., if need_x: # do lots of stuff x = whatever else: # do more x = None f(x=x, ...) # easy, but with

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-01 Thread abed...@gmail.com
Steven D'Aprano ""If param is missing **or None**, the default if blah..." I reject Chris' characterisation of this as a hack. There are function parameters where None will *never* in any conceivable circumstances become a valid argument value, and it is safe to use it as a sentinel." Yes, we

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-01 Thread abed...@gmail.com
2% of functions is a lot of functions. We're talking about a language that's been around 30 years. The feature set is pretty mature. If it were lacking features that would improve a much larger percent of code for so long, I don't think it would be as popular. It's not like the next PIP is

[Python-ideas] Adopting better naming conventions (food for thought)

2022-06-24 Thread abed...@gmail.com
I was reading some of Kevlin Henney's views on naming conventions , and I realized that, of the 65 classes that make up Python's built-in exceptions , only 8