[Python-3000] A better way to initialize PyTypeObject

Fredrik Lundh fredrik at pythonware.com
Tue Nov 28 18:48:01 CET 2006


Guido van Rossum wrote:

>>> Can't we require a C99 compiler and use C99 struct initialization?
>> that won't address the binary compatibility and optimization issues that
>> are the main rationales for my proposal, though.
> 
> Why not? This is the Py3k list -- there is no hope for binary
> compatibility with 2.x. AFAIU the C99 approach can be easily binary
> compatible between 3.0, 3.1 and beyond -- please explain if this is
> not so.

how can it be?  isn't the C99 syntax just a way to avoid filling all the 
zeros?  you'll still end up with a fixed-size structure in memory, with 
no way to move things around, and nowhere to put any auxiliary data.

> And what's the optimization issue? Do you mean the ccasional NULL
> poitner check? Once we make PyType_Ready() obligatory, it can do the
> same thing. Or whatever else you are thinking of.

null pointer checks, using different structures depending on object 
types, different ways to represent method lists (linear lists for short 
method lists, custom dictionaries for longer lists), and what else we 
might come with during our next trip to Reykjavik.

"naked structures" are a lot more limiting than data structures hidden 
behind simple API:s.

</F>



More information about the Python-3000 mailing list