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


Groups > comp.lang.python > #41103

RE: metatype

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <yushang@outlook.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.047
X-Spam-Evidence '*H*': 0.91; '*S*': 0.00; 'anyway.': 0.04; 'missed': 0.09; 'python': 0.09; 'def': 0.10; '(line': 0.16; 'new-style': 0.16; 'old-style': 0.16; 'thanks!!!': 0.16; 'to:name:python- list@python.org': 0.20; 'all,': 0.21; "i've": 0.23; 'seems': 0.23; 'pass': 0.25; 'header:In-Reply-To:1': 0.25; 'skip:[ 10': 0.26; 'wonder': 0.27; 'date:': 0.29; 'skip:_ 10': 0.29; 'source': 0.29; 'class': 0.29; 'maybe': 0.29; 'expect': 0.31; 'code': 0.31; 'to:addr:python-list': 0.33; 'thanks': 0.34; 'something': 0.35; 'subject:': 0.36; 'created': 0.36; 'email addr:python.org': 0.36; 'subject:: ': 0.38; 'from:': 0.38; 'object': 0.38; 'to:addr:python.org': 0.39; 'think': 0.40; 'email name:python- list': 0.62; '8bit%:50': 0.65; 'skip:\xe5 10': 0.65; 'dear': 0.66; 'skip:\xe2 10': 0.66; '8bit%:92': 0.70; '2013': 0.84; 'pytypeobject': 0.84; '+0800': 0.91
X-EIP [EZyiAwolOp9d8tiOFxWisEblOGGCWUKK]
X-Originating-Email [yushang@outlook.com]
Content-Type multipart/alternative; boundary="_6ffcb3bc-365a-44c3-8635-81a945465195_"
From shangyu <yushang@outlook.com>
To "python-list@python.org" <python-list@python.org>
Subject RE: metatype
Date Tue, 12 Mar 2013 09:27:36 +0800
Importance Normal
In-Reply-To <BAY404-EAS28100DF680E616854A6CE44A3E10@phx.gbl>
References <BAY404-EAS28100DF680E616854A6CE44A3E10@phx.gbl>
MIME-Version 1.0
X-OriginalArrivalTime 12 Mar 2013 01:27:36.0601 (UTC) FILETIME=[C7442890:01CE1EC0]
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3214.1363051726.2939.python-list@python.org> (permalink)
Lines 71
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1363051726 news.xs4all.nl 6875 [2001:888:2000:d::a6]:36695
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:41103

Show key headers only | View raw


[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


Thread

RE: metatype shangyu <yushang@outlook.com> - 2013-03-12 09:27 +0800

csiph-web