metatype

shangyu yushang at outlook.com
Mon Mar 11 23:22:24 CET 2013



-----原始邮件-----
发件人: "shangyu" <yushang at outlook.com>
发送时间: ‎2013/‎3/‎12 0:20
收件人: "core-mentorship at python.org" <core-mentorship at python.org>
主题: [Core-mentorship] metatype

Hi dear all,
I have following Python code
class mydict(dict):
    def __init__(self):
        pass
I wonder how this new type get created . What is the type of metatype in the following line ?
type = (PyTypeObject *)metatype->tp_alloc(metatype, nslots);
(line 2296 of typeobject.c Python2.7.3 source code)
It seems PyDict_Type . If so , how do I expect the tp_alloc will return a PyTypeObject object ? Maybe I've missed something ?
Many thanks!!!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130312/bcf575cc/attachment.html>


More information about the Python-list mailing list