Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #25056

Re: Discussion on some Code Issues

References (3 earlier) <09adb3cf-f3f2-4acc-b561-a36dcf15ecc7@googlegroups.com> <mailman.1910.1341734607.4697.python-list@python.org> <11832de7-a064-494e-b3e8-32a2f15a6902@googlegroups.com> <mailman.1922.1341767824.4697.python-list@python.org> <roy-249FE5.14174108072012@news.panix.com>
Date 2012-07-09 07:54 +1000
Subject Re: Discussion on some Code Issues
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.1930.1341784495.4697.python-list@python.org> (permalink)

Show all headers | View raw


On Mon, Jul 9, 2012 at 4:17 AM, Roy Smith <roy@panix.com> wrote:
> In article <mailman.1922.1341767824.4697.python-list@python.org>,
>  Chris Angelico <rosuav@gmail.com> wrote:
>
>> open("doc1.txt","r")
>>
>> Python will look for a file called doc1.txt in the directory you run
>> the script from (which is often going to be the same directory as your
>> .py program).
>
> Well, to pick a nit, the file will be looked for in the current working
> directory.  This may or may not be the directory you ran your script
> from.  Your script could have executed chdir() between the time you
> started it and you tried to open the file.
>
> To pick another nit, it's misleading to say, "Python will look for...".
> This implies that Python somehow gets involved in pathname resolution,
> when it doesn't.  Python just passes paths to the operating system as
> opaque strings, and the OS does all the magic of figuring out what that
> string means.

Two perfectly accurate nitpicks. And of course, there's a million and
one other things that could happen in between, too, including
possibilities of the current directory not even existing and so on. I
merely oversimplified in the hopes of giving a one-paragraph
explanation of what it means to not put a path name in your open()
call :) It's like the difference between reminder text on a Magic: The
Gathering card and the actual entries in the Comprehensive Rules.
Perfect example is the "Madness" ability - the reminder text explains
the ability, but uses language that actually is quite incorrect. It's
a better explanation, though.

Am I overanalyzing this? Yeah, probably...

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Discussion on some Code Issues subhabangalore@gmail.com - 2012-07-04 16:21 -0700
  Re: Discussion on some Code Issues Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-07-05 00:02 +0000
  Re: Discussion on some Code Issues Rick Johnson <rantingrickjohnson@gmail.com> - 2012-07-04 17:08 -0700
  Re: Discussion on some Code Issues subhabangalore@gmail.com - 2012-07-04 20:25 -0700
    Re: Discussion on some Code Issues Peter Otten <__peter__@web.de> - 2012-07-05 09:30 +0200
      Re: Discussion on some Code Issues subhabangalore@gmail.com - 2012-07-05 07:33 -0700
      Re: Discussion on some Code Issues subhabangalore@gmail.com - 2012-07-05 07:33 -0700
        Re: Discussion on some Code Issues Peter Otten <__peter__@web.de> - 2012-07-06 09:35 +0200
  Re: Discussion on some Code Issues subhabangalore@gmail.com - 2012-07-07 12:54 -0700
    Re: Discussion on some Code Issues Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-07-07 16:51 -0400
      Re: Discussion on some Code Issues subhabangalore@gmail.com - 2012-07-07 22:42 -0700
        Re: Discussion on some Code Issues Chris Angelico <rosuav@gmail.com> - 2012-07-08 18:03 +1000
          Re: Discussion on some Code Issues subhabangalore@gmail.com - 2012-07-08 10:05 -0700
            Re: Discussion on some Code Issues Chris Angelico <rosuav@gmail.com> - 2012-07-09 03:17 +1000
              Re: Discussion on some Code Issues Roy Smith <roy@panix.com> - 2012-07-08 14:17 -0400
                Re: Discussion on some Code Issues Chris Angelico <rosuav@gmail.com> - 2012-07-09 07:54 +1000
                Re: Discussion on some Code Issues Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-07-09 00:57 +0000
                Re: Discussion on some Code Issues Chris Angelico <rosuav@gmail.com> - 2012-07-09 18:41 +1000
                Re: Discussion on some Code Issues Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-07-09 12:24 +0000
                Re: Discussion on some Code Issues Chris Angelico <rosuav@gmail.com> - 2012-07-10 00:47 +1000
                Re: Discussion on some Code Issues Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-07-09 12:49 -0400
              Re: Discussion on some Code Issues subhabangalore@gmail.com - 2012-07-16 07:17 -0700
              Re: Discussion on some Code Issues subhabangalore@gmail.com - 2012-07-16 07:17 -0700
            Re: Discussion on some Code Issues MRAB <python@mrabarnett.plus.com> - 2012-07-08 19:27 +0100
          Re: Discussion on some Code Issues subhabangalore@gmail.com - 2012-07-08 10:05 -0700
        Re: Discussion on some Code Issues Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-07-08 15:07 -0400
      Re: Discussion on some Code Issues subhabangalore@gmail.com - 2012-07-07 22:42 -0700

csiph-web