<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix"><br>
      <br>
      On 01/08/2014 07:33 AM, Brett Cannon wrote:<br>
    </div>
    <blockquote
cite="mid:CAP1=2W7zt+jKsKs=zA_KpKc6taYGbztOszrwJxA5yH-2e91G-Q@mail.gmail.com"
      type="cite">
      <div dir="ltr">So let's make this idea concrete to focus a
        possible discussion. Using the example from the Clinic HOWTO and
        converting to how I see it working:<br>
        [...]<br>
      </div>
    </blockquote>
    <br>
    Yep.  And what I was proposing is much the same, except there are a
    couple extra lines in the "generated code" section.  I'd keep the
    #define for the methoddef there, and add a prototype for the
    generated parsing function (_pickle_Pickler_dump) and the docstring.<br>
    <br>
    <br>
    <div dir="ltr">
      <div class="gmail_extra">
        <div class="gmail_quote">
          <div>####################</div>
          <div><br>
          </div>
          <div>
            <div>/*[clinic input]</div>
            <div>pickle.Pickler.dump</div>
            <div><br>
            </div>
            <div>    obj: 'O'</div>
            <div>        The object to be pickled.</div>
            <div>    /</div>
            <div><br>
            </div>
            <div>Write a pickled representation of obj to the open file.</div>
            <div>[clinic start generated code]*/</div>
            <div>
              <div>PyDoc_VAR(pickle_Pickler_dump__doc__);</div>
            </div>
            <div><br>
              <div>static PyObject *</div>
              <div>_pickle_Pickler_dump(PyObject *args);<br>
              </div>
              <br>
              <div>
                <div>#define _PICKLE_PICKLER_DUMP_METHODDEF    \</div>
                <div>{"dump", (PyCFunction)_pickle_Pickler_dump, METH_O,
                  _pickle_Pickler_dump__doc__},</div>
              </div>
              <div><br>
              </div>
              static PyObject *</div>
            <div>pickle_Pickler_dump_impl(PyObject *self, PyObject *obj)</div>
            <div>/*[clinic end generated code:
              checksum=3bd30745bf206a48f8b576a1da3d90f55a0a4187]*/</div>
            <div>{</div>
            <div>    /* Check whether the Pickler was initialized
              correctly (issue3664).</div>
            <div>       Developers often forget to call __init__() in
              their subclasses, which</div>
            <div>       would trigger a segfault without this check. */</div>
                ...
          </div>
          <div>}</div>
          <div><br>
          </div>
          <blockquote type="cite">Another potential perk of doing a
            gathering of Clinic output is that if we take it to it's
            logical conclusion, then you can start to do things like
            define a method like pickle.Pickler.__init__, etc., have
            Clinic handle docstrings for modules and classes, and then
            it can end up spitting out the type struct entirely for you,
            negating the typical need to do all of that by hand (I don't
            know about the rest of you but I always just copy and paste
            that struct anyway, so having a tool slot in the right
            method names for the right positions would save me busy
            work).</blockquote>
          <br>
          Surely new code should use the functional API for creating
          types?  Anyway, yes, in the future it would be nice to get rid
          of a bunch of the busywork associated with implementing a
          Python builtin type, and Argument Clinic could definitely help
          with that.<br>
          <br>
          <br>
          <i>/arry</i><br>
        </div>
      </div>
    </div>
  </body>
</html>