On Thu, Dec 9, 2021 at 12:41 PM MRAB <pyt...@mrabarnett.plus.com> wrote:
>
> On 2021-12-08 23:39, Chris Angelico wrote:
> > On Thu, Dec 9, 2021 at 10:35 AM Paul Moore <p.f.mo...@gmail.com> wrote:
> >>
> >> On Wed, 8 Dec 2021 at 23:18, Chris Angelico <ros...@gmail.com> wrote:
> >> > Part of the problem is that it is really REALLY hard to figure out
> >> > what the actual objections are. I asked, and the one clear answer I
> >> > got was one subjective opinion that the cognitive load exceeded the
> >> > benefit. Great! That's one person's concern. I've responded to that by
> >> > clarifying parts of the cognitive load problem, and that's about as
> >> > far as that can go.
> >>
> >> Um, what parts of my response were unclear? I gave 4 specific points,
> >> Brendan gave 4 more (there wasn't much overlap with mine, either).
> >>
> >> Multiple people have mentioned that the proposed syntax is confusing.
> >> You don't have to respond to everyone individually, and indeed you
> >> shouldn't - it's the cumulative effect that matters. Telling 10 people
> >> that their concern "is one person's concern" doesn't address the fact
> >> that 10 people felt similarly. And honestly, there's only about 10
> >> active participants in this thread, so even 5 people with reservations
> >> about the syntax is still "half the people who expressed an opinion".
> >
> > I have attempted to explain the syntax. What is confusing?
> >
> > def f(x=spam): ...
> >
> > def f(x=>spam): ...
> >
> > I'm not sure what concerns need to be addressed, because I don't
> > understand the concerns. Maybe I'm just getting caught up on all the
> > side threads about "deferreds are better" and "it should be a magical
> > function instead" and I've lost some of the basics? Feel free to
> > repost a simple concern and I will attempt to respond.
> >
> [snip]
>
> I haven't been following the thread for some time, but my expectation
> would be that:
>
>      def f(x=>spam):
>          ...
>
> would behave like:
>
>      _Missing_ = object()
>
>      def f(x=_Missing_):
>          if x is _Missing_:
>              x = spam
>          ...

Yes, broadly so. The differences would be that the signature actually
says what the default will be (instead of "<object object at
0xdeadbeef>"), which in turn also means that you can type-check it
reliably (for instance, if 'spam' is '[]', then you can show that this
argument should always be a list, without having to say "or this
specific object"), and there's no need to pollute an outer context
with a sentinel value.

I prefer to describe it more like:

if x was not specified: x = spam

even though "was not specified" isn't actually valid Python code. But
the nearest equivalent in current code would be a sentinel like that.

ChrisA
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/HJJCUG2UHALNQYTJGIHDT7WR2WLTOXRJ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to