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


Groups > comp.lang.python > #100797

Re: Why doesn't os.remove work on directories?

Path csiph.com!news.mixmin.net!aioe.org!.POSTED!not-for-mail
From Laurent Delacroix <laurent@krutt.org>
Newsgroups comp.lang.python
Subject Re: Why doesn't os.remove work on directories?
Date Thu, 24 Dec 2015 13:58:45 +0100
Organization Aioe.org NNTP Server
Lines 15
Message-ID <n5gq64$ffh$1@speranza.aioe.org> (permalink)
References <mailman.77.1450844962.2237.python-list@python.org>
NNTP-Posting-Host CN8TrUQTtKt7ziBB6koACw.user.speranza.aioe.org
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252
Content-Transfer-Encoding 7bit
X-Complaints-To abuse@aioe.org
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0
X-Notice Filtered by postfilter v. 0.8.2
Xref csiph.com comp.lang.python:100797

Show key headers only | View raw


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

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


Thread

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

csiph-web