[Python-3000] A better way to initialize PyTypeObject

Fredrik Lundh fredrik at pythonware.com
Tue Nov 28 17:19:54 CET 2006


Guido van Rossum wrote:

> - Fredrik's solution makes one call per registered method. (I don't
> know if the patch he refers to follows that model.) That seems a fair
> amount of code for an average type -- I'm wondering if it's too early
> to worry about code bloat (I don't think the speed is going to
> matter).

too early, I think.

and memory is relatively cheap, compare to the costs of upgrade pain,
programmer time, and lack of optimization opportunities due to "bare
data structures".

> - Both solutions proposed require rewriting *all* type initialization.
> This is likely to require a tool that can do 99% of the work
> automatically (or else extension writers will truly hate us).

yup.  I think a tool that generates cut-that-and-paste-this instructions
for the developer should be good enough, though, and fairly easy to
write, for the reasons you give.

> 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.

</F>



More information about the Python-3000 mailing list