<br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Dec 3, 2012 at 5:29 PM, Larry Hastings <span dir="ltr"><<a href="mailto:larry@hastings.org" target="_blank">larry@hastings.org</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Say there, the Python core development community!  Have I got<br>
a question for you!<br>
<br>
*ahem*<br>
<br>
Which of the following four options do you dislike least?  ;-)<br>
<br>
1) CPython continues to provide no "function signature"<br>
   objects (PEP 362) or inspect.getfullargspec() information<br>
   for any function implemented in C.<br>
<br>
2) We add new hand-coded data structures representing the<br>
   metadata necessary for function signatures for builtins.<br>
   Which means that, when defining arguments to functions in C,<br>
   we'd need to repeat ourselves *even more* than we already do.<br>
<br>
3) Builtin function arguments are defined using some seriously<br>
   uncomfortable and impenetrable C preprocessor macros, which<br>
   produce all the various types of output we need (argument<br>
   processing code, function signature metadata, possibly<br>
   the docstrings too).<br>
<br>
4) Builtin function arguments are defined in a small DSL; these<br>
   are expanded to code and data using a custom compile-time<br>
   preprocessor step.<br>
<br>
<br>
All the core devs I've asked said "given all that, I'd prefer the<br>
hairy preprocessor macros".  But by the end of the conversation<br>
they'd changed their minds to prefer the custom DSL.  Maybe I'll<br>
make a believer out of you too--read on!<br>
<br></blockquote><div><br></div><div>[snip]</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
* There's actually a fifth option, proposed by Brett Cannon.  We<br>
  constrain the format of docstrings for builtin functions to make<br>
  them machine-readable, then generate the function signature objects<br>
  from that.  But consider: generating *everything* in the signature<br>
  object may get a bit tricky (e.g. Parameter.POSITIONAL_ONLY), and<br>
  this might gunk up the docstring.<br></blockquote><div><br></div><div>I should mention that I was one of the people Larry pitched this to and this fifth option was before I fully understood the extent the DSL supported the various crazy options needed to support all current use-cases in CPython.</div>

<div><br></div><div>Regardless I fully support what Larry is proposing.</div></div></div>