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


Groups > comp.lang.python > #100760 > unrolled thread

Why doesn't os.remove work on directories?

Started byRandom832 <random832@fastmail.com>
First post2015-12-22 23:29 -0500
Last post2015-12-24 13:58 +0100
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  Why doesn't os.remove work on directories? Random832 <random832@fastmail.com> - 2015-12-22 23:29 -0500
    Re: Why doesn't os.remove work on directories? Laurent Delacroix <laurent@krutt.org> - 2015-12-24 13:58 +0100

#100760 — Why doesn't os.remove work on directories?

FromRandom832 <random832@fastmail.com>
Date2015-12-22 23:29 -0500
SubjectWhy doesn't os.remove work on directories?
Message-ID<mailman.77.1450844962.2237.python-list@python.org>
This is surprising to anyone accustomed to the POSIX C remove
function, which can remove either files or directories.  Is there
any known rationale for this decision?

[toc] | [next] | [standalone]


#100797

FromLaurent Delacroix <laurent@krutt.org>
Date2015-12-24 13:58 +0100
Message-ID<n5gq64$ffh$1@speranza.aioe.org>
In reply to#100760
On 23/12/15 05:29, Random832 wrote:
> 
> This is surprising to anyone accustomed to the POSIX C remove
> function, which can remove either files or directories.  Is there
> any known rationale for this decision?
> 

Hello, in POSIX C the remove() function is actually rmdir() when called
on a directory: http://bit.ly/1NE1rfZ

I'm not sure about the rationale behind raising OSError if the argument
is a directory though. Maybe the "There should be one-- and preferably
only one --obvious way to do it." philosophy explains it. :-)

Lau

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web