New submission from BTaskaya <batuhanosmantask...@gmail.com>:
CPython only makes these methods class method when a class created. If you set __class_getitem__ method after the creation it doesn't work unless you use classmethod decorator manually. >>> class B: ... pass ... >>> def y(*a, **k): ... return a, k ... >>> B.__class_getitem__ = y >>> B[int] ((<class 'int'>,), {}) >>> B.__class_getitem__ = classmethod(y) >>> B[int] ((<class '__main__.B'>, <class 'int'>), {}) ---------- messages: 335985 nosy: BTaskaya priority: normal severity: normal status: open title: Setting __init_subclass__ and __class_getitem__ methods are in runtime doesnt make them class method. type: behavior _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36042> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com