<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    On 28.04.12 21:16, Brett Cannon wrote:
    <blockquote
cite="mid:CAP1=2W5eFdUAuZfT0gZ+91gWvzVs7XVs-_hKtgYqbyVSdZZ6_A@mail.gmail.com"
      type="cite"><br>
      <br>
      <div class="gmail_quote">On Sat, Apr 28, 2012 at 04:08, Nick
        Coghlan <span dir="ltr">&lt;<a moz-do-not-send="true"
            href="mailto:ncoghlan@gmail.com" target="_blank">ncoghlan@gmail.com</a>&gt;</span>
        wrote:<br>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div class="im">On Sat, Apr 28, 2012 at 6:00 AM, Brett Cannon
            &lt;<a moz-do-not-send="true" href="mailto:brett@python.org">brett@python.org</a>&gt;
            wrote:<br>
            &gt; I'm personally in favour of changing the insertion of
            '' to sys.path to<br>
            &gt; inserting the cwd when the interpreter is launched.<br>
            <br>
          </div>
          I'm not, because it breaks importing from the interactive
          prompt if<br>
          you change directory after starting the session.<br>
          <br>
        </blockquote>
        <div><br>
        </div>
        <div>Who does that? I mean what possible need do you have to
          start the interpreter in one directory, but then need to chdir
          somewhere else where you are doing your actual importing from,
          and in a way where you can't simply attach the directory you
          want to use into sys.path?</div>
        <div><br>
        </div>
      </div>
    </blockquote>
    <br>
    Well, it depends on which hat I'm wearing.<br>
    <br>
    Scenario 1:<br>
    I am designing a big application. This application shall run without
    problems,<br>
    with disambiguated imports, and by no means should hit anything that
    is not<br>
    meant to be imported.<br>
    In this case, I need to remove '' from sys.path and replace it with
    an absolute entry.<br>
    <br>
    Update: I see this works already unless "-c" and "-m" are present
    (hum).<br>
    <br>
    Scenario 2:<br>
    I am playing with the application, want to try several modules, or
    even several versions<br>
    of modules. I do use os.chdir() to get into a certain context, try
    imports, remove them<br>
    again, chdir() to a different directory with a slightly changed
    module, et cetera.<br>
    In this case, I need '' (or as has been mentioned '.') to have
    flexibility for testing,<br>
    debugging and exploration.<br>
    <br>
    These scenarios are both perfectly valid for their use case, but
    they have pretty<br>
    different implication for imports, and especially for sys.path.<br>
    <br>
    So the real question I was after was "can os.chdir() be freely
    used?"<br>
    <br>
    It would be great to get "yes" or "no", but the answer is right now
    "it depends".<br>
    <br>
    cheers - chris<br>
    <pre class="moz-signature" cols="72">-- 
Christian Tismer             :^)   <a class="moz-txt-link-rfc2396E" href="mailto:tismer@stackless.com">&lt;mailto:tismer@stackless.com&gt;</a>
tismerysoft GmbH             :     Have a break! Take a ride on Python's
Karl-Liebknecht-Str. 121     :    *Starship* <a class="moz-txt-link-freetext" href="http://starship.python.net/">http://starship.python.net/</a>
14482 Potsdam                :     PGP key -&gt; <a class="moz-txt-link-freetext" href="http://pgp.uni-mainz.de">http://pgp.uni-mainz.de</a>
work +49 173 24 18 776  mobile +49 173 24 18 776  fax n.a.
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   <a class="moz-txt-link-freetext" href="http://www.stackless.com/">http://www.stackless.com/</a></pre>
  </body>
</html>