Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #41095 > unrolled thread

metatype

Started byshangyu <yushang@outlook.com>
First post2013-03-12 06:22 +0800
Last post2013-03-12 06:22 +0800
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  metatype shangyu <yushang@outlook.com> - 2013-03-12 06:22 +0800

#41095 — metatype

Fromshangyu <yushang@outlook.com>
Date2013-03-12 06:22 +0800
Subjectmetatype
Message-ID<mailman.3209.1363040697.2939.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

-----原始邮件-----
发件人: "shangyu" <yushang@outlook.com>
发送时间: ‎2013/‎3/‎12 0:20
收件人: "core-mentorship@python.org" <core-mentorship@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!!!

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web