Final classes in Python 3.x- something Guido isn't telling me?

前端 未结 4 1222
走了就别回头了
走了就别回头了 2020-12-08 13:55

This question is built on top of many assumptions. If one assumption is wrong, then the whole thing falls over. I\'m still relatively new to Python and have just entered the

4条回答
  •  春和景丽
    2020-12-08 14:12

    You could do this only via the C API. Clear the Py_TPFLAGS_BASETYPE bit of the tp_flags of the type object.

    Like this: http://svn.python.org/projects/python/trunk/Objects/boolobject.c (vs intobject.c where Py_TPFLAGS_BASETYPE is set).

提交回复
热议问题