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?

From Laurent Delacroix <laurent@krutt.org>
Newsgroups comp.lang.python
Subject Re: Why doesn't os.remove work on directories?
Date 2015-12-24 13:58 +0100
Organization Aioe.org NNTP Server
Message-ID <n5gq64$ffh$1@speranza.aioe.org> (permalink)
References <mailman.77.1450844962.2237.python-list@python.org>

Show all headers | 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