<div class="gmail_quote">On Tue, Nov 20, 2012 at 11:45 PM, Christian Tismer <span dir="ltr"><<a href="mailto:tismer@stackless.com" target="_blank">tismer@stackless.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

  
    
  
  <div bgcolor="#FFFFFF" text="#000000"><div><div class="h5">
    <div>On 20.11.12 12:39, Nick Coghlan wrote:<br>
    </div>
    <blockquote type="cite">
      <div class="gmail_quote">On Tue, Nov 20, 2012 at 7:06 PM, Kristján
        Valur Jónsson <span dir="ltr"><<a href="mailto:kristjan@ccpgames.com" target="_blank">kristjan@ccpgames.com</a>></span>
        wrote:<br>
        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div link="blue" vlink="purple" lang="EN-GB">
            <div>
              <p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I’m
                  intrigued.  I thought this was merely so that one
                  could do</span></p>
              <p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">python
                  –m mypackage.mysubpackage</span></p>
              <p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Can
                  you refer me to the rationale and discussion about
                  this feature?</span></p>
            </div>
          </div>
        </blockquote>
        <div><br>
          It was part of a fairly long progression in changes to the
          command line execution support :)<br>
          <br>
          Top level package execution with -m came first in 2.4,
          arbitrary package execution for -m arrived in 2.5 (along with
          the runpy module), directory and zipfile execution (by
          supplying a valid sys.path entry as the "script" command line
          argument) was added in 2.6/3.0, and finally officially
          supported package execution via -m only arrived in 2.7 and 3.1
          (a broken version of the last accidentally existed in 2.5, but
          that was just a mistake that arose when merging the import
          emulations in runpy and pkgutil, and had a side effect that
          violated at least one of the import system invariants).<br>
          <br>
          In the specific case of directory and zipfile execution,
          discussion happened on the tracker: <a href="http://bugs.python.org/issue1739468" target="_blank">http://bugs.python.org/issue1739468</a><br>
          <br>
          It was never brought up on python-dev because Guido was
          participating directly in the tracker discussion.
          Unfortunately, we then also forgot to mention it in the
          original version of the 2.6 What's New doc, so the vast
          majority of people missed the addition :(<br>
        </div>
      </div>
    </blockquote>
    <br></div></div>
    Hi Nick,<br>
    <br>
    thank you very much for this story and the link to the issue
    tracker!<br>
    A very good move for Python which is really not mentioned enough<br>
    to make people more aware of a great feature.<br>
    <br>
    I think part of this discussion should get a more prominent place<br>
    for gems that can be found without knowing what to search. ;-)<br></div></blockquote><div><br>Technically, that's the "using" guide: <a href="http://docs.python.org/2/using/cmdline.html#interface-options">http://docs.python.org/2/using/cmdline.html#interface-options</a> (see the explanation of what's executable under the "<script>" tag)<br>
<br>I also wrote up a summary last year on my blog: <a href="http://www.boredomandlaziness.org/2011/03/what-is-python-script.html">http://www.boredomandlaziness.org/2011/03/what-is-python-script.html</a><br><br>(The main change since that post is that the Python launcher brings shebang line support to Windows, although I haven't checked if it works properly with prefixed zip files)<br>
<br>Maybe I should plan to sign up to present an updated version of my PyCon AU 2010 "What is a Python script?" lightning talk at PyCon US 2013 :)<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
    
    Is the issue tracker permanent enough to reference it?<br></div></blockquote><div><br>I've been referencing that particular issue for years now, so I certainly think so :)<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
    Maybe there could be some auxiliary info page with proper keywords<br>
    that collects links to relevant discussions like this.<br>
    Do we have such a thing already?<br></div></blockquote><div><br>I've sometimes thought it may be a good idea to split out a separate "What is a Python script?" section in the using guide, separate from the existing descriptions under the interpreter options. I've never tried to figure out the details of how that would actually work, though.<br>
<br>Cheers,<br>Nick.<br clear="all"></div></div><br>-- <br>Nick Coghlan   |   <a href="mailto:ncoghlan@gmail.com">ncoghlan@gmail.com</a>   |   Brisbane, Australia<br>