(original) (raw)

On 15 December 2017 at 17:47, Yury Selivanov <yselivanov.ml@gmail.com> wrote:
Shouldn't we optimize the usability for pure-Python first, and then for C API?

Right now we have the '\_\_new\_\_' magic method, which isn't a
@classmethod. Making '\_\_class\_getitem\_\_' a @classmethod will confuse
regular Python users. For example:

class Foo:
def \_\_new\_\_(cls, ...): pass

@classmethod
def \_\_class\_getitem\_\_(cls, item): pass

To me it makes sense that type methods that are supposed to be called
on type by the Python interpreter don't need the classmethod
decorator.

Good point! Pure Python will be the primary use case and we have another precedent
for "automatic" class method: \_\_init\_subclass\_\_ (it does not need to be decorated).
METH\_STATIC is a public working API, and in my opinion it's totally
fine if we use it. It's not even hard to use it, it's just \*mildly\*
inconvenient at most.

OK, then documenting this "recipe" (METH\_STATIC plus tuple unpacking) should be sufficient.

--
Ivan