[Python-3000] A better way to initialize PyTypeObject

Guido van Rossum guido at python.org
Tue Nov 28 18:34:33 CET 2006


On 11/28/06, Fredrik Lundh <fredrik at pythonware.com> wrote:
> 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.

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.

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.
-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list