(original) (raw)
On 15 December 2017 at 15:55, Yury Selivanov <yselivanov.ml@gmail.com> wrote:
> I don't see any problems with implementing this on types defined in C. This isn't harder than implementing \_\_sizeof\_\_ or pickling support, and NumPy classes already have implemented both. Maybe Yury forgot about METH\_STATIC and METH\_CLASS?
I just tested \_\_class\_getitem\_\_ defined via METH\_STATIC and it works.
This means we don't need to add slots. Thanks for the hint, Serhiy!
Ivan, this might be worth mentioning in the PEP or in the docs.
I think it should be added to the PEP. Somehow I didn't think about C extensions, but now I see that it is important, also recently there appeared a lot of interest in better support of static typing for NumPy arrays and numeric stack.
I will make a PR a bit later.
--
Ivan