[Python-Dev] os.removedirs() vs. shutil.rmtree()

2005-01-08 Thread Skip Montanaro
Is there a reason the standard library needs both os.removedirs and
shutil.rmtree?  They seem awful similar to me (I can see they aren't really
identical).  Ditto for os.renames and shutil.move.  Presuming they are all
really needed, is there some reason they don't all belong in the same
module?

Skip
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] os.removedirs() vs. shutil.rmtree()

2005-01-08 Thread Johannes Gijsbers
On Sat, Jan 08, 2005 at 02:45:25PM -0600, Skip Montanaro wrote:
 Is there a reason the standard library needs both os.removedirs and
 shutil.rmtree?  They seem awful similar to me (I can see they aren't really
 identical).  Ditto for os.renames and shutil.move.  Presuming they are all
 really needed, is there some reason they don't all belong in the same
 module?

os.removedirs() only removes directories, it will fail to remove a
non-empty directory, for example. It also doesn't have the
ignore_errors/onerror arguments [1]. os.renames() is different from
shutil.move() in that it also creates intermediate directories (and
deletes any left empty).

So they're not identical, but I do agree they should be consolidated
and moved into one module. I'd say shutil, both because the os
module is already awfully crowded, and because these functions are
high-level operations on files and collections of files rather
than a more portable way of using operating system dependent
functionality [...].

Johannes

[1] That may actually be a good thing, though. It was a pain to keep
those working backwards-compatibly when shutil.rmtree was recently
rewritten.
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com