Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #16879
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Gregory Ewing <greg.ewing@canterbury.ac.nz> |
| Newsgroups | comp.lang.python |
| Subject | Re: tp_new, tp_alloc, tp_init |
| Date | Fri, 09 Dec 2011 10:33:10 +1300 |
| Lines | 16 |
| Message-ID | <9kcoopFv41U1@mid.individual.net> (permalink) |
| References | <f0bb1447-07b2-4f78-a1af-c702ff2ca31a@da3g2000vbb.googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | individual.net 6F4xW8z81Cn/QrZVr+zfegt69SqVENsTh9+b9LYaMI6A6RZNaW |
| Cancel-Lock | sha1:Gx9kLmTMviG7Ifdqd9VRTuFvbT4= |
| User-Agent | Mozilla Thunderbird 1.0.5 (Macintosh/20050711) |
| X-Accept-Language | en-us, en |
| In-Reply-To | <f0bb1447-07b2-4f78-a1af-c702ff2ca31a@da3g2000vbb.googlegroups.com> |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:16879 |
Show key headers only | View raw
Michael Hennebry wrote: > I've been reading about writing extension types in C and am rather > fuzzy about the relationship between tp_new, tp_alloc and tp_init. > Most especially, why tp_new? It seems to me that tp_alloc and tp_init > would be sufficient. tp_new and tp_init correspond to the Python methods __new__ and __init__, and they're separated for the same reasons they are in Python. tp_alloc is separate because it allows a type to use a custom memory allocator without disturbing the rest of the initialisation mechanism. -- Greg
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
tp_new, tp_alloc, tp_init Michael Hennebry <egg1nog@gmail.com> - 2011-11-30 09:10 -0800 Re: tp_new, tp_alloc, tp_init Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-12-09 10:33 +1300
csiph-web