(original) (raw)
On Tue, Jan 7, 2014 at 6:24 PM, Larry Hastings <larry@hastings.org> wrote:
For what it's worth, if we use the "accumulator" approach I propose that the generated code doesn't go at the very end of the file. Instead, I suggest they should go \*near\* the end, below the implementations of the module / class methods, but above the methoddef/type structures and the module init function.On 01/07/2014 12:46 PM, Mark Lawrence wrote:
Maybe overkill but why not follow 3 with 2 at the end of the file, the marker to be a very clear /\* Generated by Argument Clinic - DO NOT EDIT BELOW THIS LINE \*/ or whatever wording is appropriate in this case.
If it is accumulated in a single location should it just be a single block for everything towards the end? Then forward declarations would go away (you could still have it as a comment to copy-and-paste where you define the implementation) and you can have a single macro for the PyMethodDef values, each class, etc. If you accumulated the PyMethodDef values into a single macro it would help make up for the convenience lost of converting a function by just cutting the old call signature up to the new \*\_impl() function.
My reasoning: when I navigate CPython C files implementing a module or a type, when I know what entry point I want I just search for its name. When I don't know what I want, I jump to the end, then scroll up until I find the name in the init function or the structures. So I wouldn't want the code at the very end; that would screw up that navigation mode.
That's how I navigate as well.