I read PEP 671 today, and I feel PEP 671 is not as useful as someone expected.
For example, PEP 671 has this example:
def bisect_right(a, x, lo=0, hi=>len(a), *, key=None):
But I think we can not change the signature for backward
compatibility. For example,
def search(self, x, lo=0, hi=None):
return bisect_right(self._data, x, lo=lo, hi=hi)
If we just change the signature of bisect_right, this wrapper method
will be broken.
So bisect_right should support None for several versions and emit
frustrating DeprecationWarning.
I don't think this change has good cost/performance.
Additionally, this example illustrates that PEP 671 is not wrapper
functions friendly.
If the wrapped functions uses PEP 671, wrapper functions should:
* Copy & paste all default expressions, or
* But default expression may contain module private variables...
* Use **kwds and hide real signatures.
I have not read all of PEP 671 threads so I am sorry if this is
already discussed.
But this topic is not covered in current PEP 671 yet.
Generally speaking, I don't want to add anything to Python language
that makes Python more complex.
But if I chose one PEP, I prefer PEP 505 than PEP 671.
PEP 505 can be used for default parameters (e.g. `hi ??= len(a)`) and
many other places.
I feel it has far better benefit / language complexity ratio.
Regards,
--
Inada Naoki <[email protected]>
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/JRIKPS5GCMTHUX25UVBBIQ527ZI6VZHN/
Code of Conduct: http://python.org/psf/codeofconduct/