Rename file without overwriting existing files

Grant Edwards grant.b.edwards at gmail.com
Mon Jan 30 10:56:01 EST 2017


On 2017-01-30, Terry Reedy <tjreedy at udel.edu> wrote:
> On 1/30/2017 8:58 AM, Peter Otten wrote:
>> Jussi Piitulainen wrote:
>
>>> It doesn't seem to be documented.
>>
>> For functions with a C equivalent a look into the man page is usually
>> helpful.
>
> Man pages do not exist on Windows.  I suspect that there are more 
> individual Python programs on Windows than *nix.  I am more sure of this 
> as applied to beginners, most of whom have no idea what a 'man' page is 
> (sexist docs? ;-).

IMO, beginners shouldn't be using the os module.  This is implied by
the first parapgraph of the doc:

     If you just want to read or write a file see open(), if you want
     to manipulate paths, see the os.path module, and if you want to
     read all the lines in all the files on the command line see the
     fileinput module. For creating temporary files and directories
     see the tempfile module, and for high-level file and directory
     handling see the shutil module.

When you're using the OS module, you're just writing C code in Python.
[Which, BTW, is a _very_ useful thing to be able to do, but it's
probably not what beginners are trying to do.]

I always found the first sentence to be a bit funny:

     This module provides a portable way of using operating system
     dependent functionality.

I understand whay they're tying to say, but I always found it amusing
to say you're going to provide a portable way to do something
non-portable.

-- 
Grant Edwards               grant.b.edwards        Yow! Somewhere in DOWNTOWN
                                  at               BURBANK a prostitute is
                              gmail.com            OVERCOOKING a LAMB CHOP!!



More information about the Python-list mailing list