Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
tp_new, tp_alloc, tp_init
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Michael Hennebry  
View profile  
 More options Nov 30 2011, 12:10 pm
Newsgroups: comp.lang.python
From: Michael Hennebry <egg1...@gmail.com>
Date: Wed, 30 Nov 2011 09:10:09 -0800 (PST)
Local: Wed, Nov 30 2011 12:10 pm
Subject: tp_new, tp_alloc, tp_init
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.

Most of my reading has been in the Noddy and Shoddy portions of
docs.python.,org .


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gregory Ewing  
View profile  
 More options Dec 8 2011, 4:33 pm
Newsgroups: comp.lang.python
From: Gregory Ewing <greg.ew...@canterbury.ac.nz>
Date: Fri, 09 Dec 2011 10:33:10 +1300
Local: Thurs, Dec 8 2011 4:33 pm
Subject: Re: tp_new, tp_alloc, tp_init

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »