[Python-Dev] PEP 575: Unifying function/method classes (original) (raw)

Guido van Rossum guido at python.org
Sat Apr 14 17:14:40 EDT 2018


On Sat, Apr 14, 2018 at 2:17 AM, Jeroen Demeyer <J.Demeyer at ugent.be> wrote:

On 2018-04-13 21:30, Raymond Hettinger wrote:

It would be nice to have a section that specifically discusses the implications with respect to other existing function-like tooling: classmethod, staticmethod, partial, itemgetter, attrgetter, methodgetter, etc.

My hope is that there are no such implications. An important design goal of this PEP (which I believe I achieved) is that as long as you're doing duck typing, you should be safe. I believe that the tools in your list do exactly that. It's only when you use inspect or when you do type checks that you will see the difference with this PEP.

That actually sounds like a pretty big problem. I'm sure there is lots of code that doesn't just duck-type nor calls inspect but uses isinstance() to decide how to extract the desired information.

After implementing the C code part of my PEP, there were only a relatively small number of test failures. You can look at this commit which contains all Python code changes of my implementation, it doesn't look so bad:

https://github.com/jdemeyer/cpython/commit/c404a8f1b7d9525dd 2842712fe183a051a4b5094 For example, I would need to update the code in random.randbelow().

For the record, there are no test failures related to this, but maybe that's just because tests for this are missing.

-- --Guido van Rossum (python.org/~guido) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20180414/0909057f/attachment.html>



More information about the Python-Dev mailing list