On 10/26/21 12:08 PM, Ricky Teachey wrote:
> On Tue, Oct 26, 2021 at 2:40 PM Chris Angelico wrote:

>> Do you have any examples where this isn't the case?
>
> I don't. I only have a niggling feeling that maybe this is a bigger problem 
than
> we're giving it credit for.
>
> At bottom I guess I'd describe the problem this way: with most APIs, there is 
a way
> to PASS SOMETHING that says "give me the default". With this proposed API, we 
don't
> have that; the only want to say "give me the default" is to NOT pass 
something.
>
> I don't KNOW if that's a problem, it just feels like one.

Several times I've had to write code that calls a function in several different ways, based solely on where I could pass None to get the default behavior:

    my_wrapper_func(this, that, the_other=None):
        if framework.version > 4:
            framework.utility(this, that, the_other)
        elif framework.version > 3.5:
            if the_other is None:
               framework.utility(this, that)
            else:
               framework.utility(this, that, the_other)

What a pain.

When this PEP originally came out I thought that passing None was the way to trigger it -- if that's not the case, and there is nothing we can pass to trigger it, I am much less interested.

--
~Ethan~
_______________________________________________
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/YBRFL4XISDGXKCVXTBR4WVS3UJWP4DRR/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to