Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #41103
| From | shangyu <yushang@outlook.com> |
|---|---|
| Subject | RE: metatype |
| Date | 2013-03-12 09:27 +0800 |
| References | <BAY404-EAS28100DF680E616854A6CE44A3E10@phx.gbl> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3214.1363051726.2939.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
I think I've found it out . For new-style class it's PyType_Type and for old-style class it's PyClass_Type . Thanks anyway.
To: python-list@python.org
From: yushang@outlook.com
Subject: metatype
Date: Tue, 12 Mar 2013 06:22:24 +0800
发件人: shangyu
发送时间: 2013/3/12 0:20
收件人: 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!!!
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
RE: metatype shangyu <yushang@outlook.com> - 2013-03-12 09:27 +0800
csiph-web