GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • [ date ]
  • [ thread ]
  • [ subject ]
  • [ author ]

This view

  • Original page
  • New address

GeezerVison is showing mail.python.org — [Python-Dev] Make __class_getitem__ a class method

[Python-Dev] Make __class_getitem__ a class method

Ivan Levkivskyi levkivskyi at gmail.com
Fri Dec 15 12:04:38 EST 2017

  • Previous message (by thread): [Python-Dev] Make __class_getitem__ a class method
  • Next message (by thread): [Python-Dev] __init_subclass__ is a class method (Was: Make __class_getitem__ a class method)
  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

On 15 December 2017 at 17:47, Yury Selivanov <yselivanov.ml at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20171215/ca2c2610/attachment.html>

  • Previous message (by thread): [Python-Dev] Make __class_getitem__ a class method
  • Next message (by thread): [Python-Dev] __init_subclass__ is a class method (Was: Make __class_getitem__ a class method)
  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

More information about the Python-Dev mailing list
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.