Message335985
| Author | BTaskaya |
|---|---|
| Recipients | BTaskaya |
| Date | 2019-02-19.17:19:55 |
| SpamBayes Score | -1.0 |
| Marked as misclassified | Yes |
| Message-id | <1550596795.62.0.0325313661294.issue36042@roundup.psfhosted.org> |
| In-reply-to |
| Content | |
|---|---|
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'>), {}) |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2019-02-19 17:19:55 | BTaskaya | set | recipients: + BTaskaya |
| 2019-02-19 17:19:55 | BTaskaya | set | messageid: <1550596795.62.0.0325313661294.issue36042@roundup.psfhosted.org> |
| 2019-02-19 17:19:55 | BTaskaya | link | issue36042 messages |
| 2019-02-19 17:19:55 | BTaskaya | create | |