[Python-3000] C API changes? [Was: Python 3000 Process]
Thomas Wouters
thomas at python.org
Wed Mar 22 11:49:12 CET 2006
On 3/22/06, Neal Norwitz <nnorwitz at gmail.com> wrote:
>
> On 3/21/06, Neil Schemenauer <nas at arctrix.com> wrote:
> > On Tue, Mar 21, 2006 at 08:52:34PM -0800, Neal Norwitz wrote:
> > > I thought about re-organizing all the methods to try to group them
> > > a bit better. Then I realized the beneift is likely far too small
> > > for the larger pain of having to maintain 2 tables of methods (one
> > > for 2.x one for 3.x).
> >
> > Maybe C99 designated initializers could solve that problem (assuming
> > we are going to require a C99 compiler).
>
> That (using initializers) would be good for several reasons. We can
> get rid of the "holes" 0s. We don't need the comments as they would
> be redudant with the real names.
For the old and ignorant among us (although I concede I may be the only one)
could someone explain 'designated initializers' and how the code would look?
As for keeping 3.x and 2.x Type structs similar, we _could_ add a new type
struct for 3.0 and transparently support the old type struct (by translating
it to a 3.0 one.) The two structs would have to be mirrored for the benefit
of the 'old' code (so references to typeobj.tp_free where it was initialized
to 0 would still work right) but at least we can have source-level
perfection without compromizing source-level backward compatibility.
If we used C99, we could also use // comments and inline declarations,
> rather than only at the start of a scope. I would like all of these,
> though I'm not sure we want to require C99. I updated the PEP with an
> outstanding issues section and added using C99.
I'm not sure I like those. In fact, I'm pretty sure I don't :) // is all
about style; I don't think it has any. Inline declarations is about code
readability. Code that spreads out the declarations all over the place just
look messy. I'll grant that there are cases where it's more logical to keep
a declaration right near its (only) use, but a great many of those cases
also introduce a new block. I've worked a bit with (messy) C99 code, and I
always got a much clearer picture of what a function tries to do (and how
messy it is) when I moved all the declarations to the top of the
function/block. Just my two cents; I'll happily follow whatever PEP-3007
says.
Speaking of PEP-3007, any ideas on how different from PEP-0007 it'll be?
tabs or four-space indents? How rigourously will it be applied? (I honestly
don't have any problems with PEP-0007 except for its intermittent
application.) Do we get to arbitrarily clean up extensions and the like? :>
--
Thomas Wouters <thomas at python.org>
Hi! I'm a .signature virus! copy me into your .signature file to help me
spread!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-3000/attachments/20060322/880709db/attachment.html
More information about the Python-3000
mailing list