A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/attachments/20160804/d8f7d001/attachment.html below:

<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 08/04/2016 03:45 PM, Alexander
      Belopolsky wrote:<br>
    </div>
    <blockquote
cite="mid:CAP7h-xYqdo1zDw8QB_1o1nQe7ZhsX8o1TzMU45Q7kFyBBg4qdw@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra"><br>
          <div class="gmail_quote">On Thu, Aug 4, 2016 at 2:19 PM, Larry
            Hastings <span dir="ltr"><<a moz-do-not-send="true"
                href="mailto:larry@hastings.org" target="_blank">larry@hastings.org</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">AFAIK
              the Clinic DSL can handle all of Python's C extensions.  I
              have no plans to "revise the whole approach"; if someone
              else does I haven't heard about it.</blockquote>
          </div>
          <br>
          I was just wondering that with so much effort to bring typing
          to the mainstream, a more "pythonic" DSL may emerge for
          describing the signatures of functions in C modules. </div>
        <div class="gmail_extra"><br>
        </div>
        <div class="gmail_extra">BTW, is there any document describing
          the syntax of "text signatures" such as:</div>
        <div class="gmail_extra"><br>
        </div>
        <div class="gmail_extra">>>>
          os.rename.__text_signature__</div>
        <div class="gmail_extra">'($module, /, src, dst, *,
          src_dir_fd=None, dst_dir_fd=None)'</div>
        <div class="gmail_extra"><br>
        </div>
        <div class="gmail_extra">? </div>
        <div class="gmail_extra"><br>
        </div>
        <div class="gmail_extra">What does the "$module, /," part mean?</div>
      </div>
    </blockquote>
    <p><br>
    </p>
    <p>/ is the delimiter between positional-only parameters and
      positional-or-keyword arguments.  It's not actual Python syntax,
      but Guido said (somewhere) that *if* Python ever sprouted a syntax
      for positional-only parameters, that was as good a delimiter as
      any.  I think he picked it because / is the inverse of *.<br>
    </p>
    <p>The "$" in "$module" means it's what we called a "bound
      parameter", a parameter which gets bound to a value before Python
      ever sees it.  C extension functions get the module passed in
      automatically, but this is done internally and from the Python
      level you can't see it.  So it's accurate to present it there, but
      we suppress it before we compute the inspect.signature.  For
      example, os_chdir_impl in Modules/posixmodule.c takes two
      arguments, the first being the module, the second being the path;
      inspect.signature(os.chdir) only shows one parameter, the path.<br>
    </p>
    <p>__text_signature__, although user-visible, is not considered
      information for users.  It's an internal implementation detail
      like co_code.  However, with the exception of things like
      "$module" and "/" it's just a Python function declaration. 
      Literally we remove the funny bits like "$module" and "/", prepend
      that string with "def foo", append that string with ": pass", and
      parse the result with ast.parse.</p>
    <p>If you have more questions about __text_signature__, I recommend
      reading the implementation of inspect.signature, since that's the
      one and only consumer of it.<br>
    </p>
    <p><br>
    </p>
    <p><i>/arry</i><br>
    </p>
  </body>
</html>

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4