[Python-Dev] Make class_getitem a class method (original) (raw)

Ivan Levkivskyi levkivskyi at gmail.com
Fri Dec 15 18:00:47 EST 2017


On 15 December 2017 at 19:35, Serhiy Storchaka <storchaka at gmail.com> wrote:

15.12.17 20:02, Yury Selivanov пише:

But nobody decorates new with a @staticmethod. And making classgetitem a @classmethod will only confuse users -- that's all I'm saying.

So I'm +1 to keep the things exactly as they are now. It would be great do document that in order to implement classgetitem in C one should add it as METHSTATIC. I also think we should merge your PR that tests that it works the way it's expected. In this case I suggest to make classgetitem an automatic class method like initsubclass. The number of special cases bothers me.

I just want to clarify what is proposed. As I understand:

If this is true that this looks reasonable. If no-one is against, then I can make a PR. The only downside to this that I see is that type.__new__ will be slightly slower.

-- Ivan -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20171216/128d8c55/attachment.html>



More information about the Python-Dev mailing list