Cannot inherit from multiple classes defining __slots__?

前端 未结 4 1001
情歌与酒
情歌与酒 2020-12-14 18:28

A certain situation in Python recently alarmed me, and its reason is still not completely clear after a little research. The following class definitions appear to work flawl

4条回答
  •  醉梦人生
    2020-12-14 18:37

    Have you seen this alternative? https://stackoverflow.com/a/53063670/1400467

    There's a "tricky" workaround by using metaclasses and a fake _slots_ attribute. This works in Python 3.6 and hope in Python 3.X so.

提交回复
热议问题