On Wed, 28 Mar 2018 19:22:50 +0200 Erik Bray <erik.m.b...@gmail.com> wrote: > > I don't really see your point in this example. For one: why would > anyone do this? Is this based on a real example?
Yes, I remember doing that when writing unit tests for open() and open()-like functions. You would write a base test case: class TestBase: open_func = None def test_something(self): self.open_func(...) # etc. and then instantiate concrete subclasses: class BuiltinOpenTest(TestBase, unittest.TestCase): open_func = open class PyOpenTest(TestBase, unittest.TestCase): open_func = staticmethod(_pyio.open) > 2) That's how any > function works. If you put some arbitrary function in a class body, > and it's not able to accept an instance of that class as its first > argument, then it will always be broken unless you make it a > staticmethod. I don't see how there should be any difference there if > the function were implemented in Python or in C. I agree that there *should* be no difference. The point is, there is currently a difference and suppressing it may break compatibility. I don't think the breakage is important enough to stop us from streamlining things here. Just pointing out the risk exists. Regards Antoine. _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/