Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!bcyclone02.am1.xlned.com!bcyclone02.am1.xlned.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.029 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'subject:Python': 0.06; 'subject: -- ': 0.07; '"if': 0.09; "system's": 0.09; 'cc:addr :python-list': 0.11; 'deletion': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'phase,': 0.16; 'subject:Move': 0.16; 'substituted': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'deleted.': 0.24; 'instead.': 0.24; "shouldn't": 0.24; 'cc:2**0': 0.24; '15,': 0.26; 'header:In-Reply- To:1': 0.27; 'raise': 0.29; 'operations,': 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'file': 0.32; 'fri,': 0.33; "can't": 0.35; 'but': 0.35; 'received:google.com': 0.35; '14,': 0.36; 'subject:?': 0.36; 'should': 0.36; 'application': 0.37; 'sometimes': 0.38; 'pm,': 0.38; 'moving': 0.39; 'delete': 0.39; 'sure': 0.39; 'even': 0.60; 'catch': 0.60; 'deleting': 0.60; 'ian': 0.60; 'truly': 0.60; "you're": 0.61; 'more': 0.64; 'different': 0.65; '2015': 0.84; 'subject:Survey': 0.91; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=9K/sQ8iIS0wU/BgulDyfG2F38DmCI7FiQ789uQzE6bU=; b=PalJJlZTEkDgluMmmQS8zy1k9ZkvP/cV4q50neaP5n5qq9AZFo4HkpvSnSXdV2chcM TjcDSD+5qGOFpZMIel929NDc/nvIcRvyna0JZnZxEFdzhvyNWkgM7NLlMhj6UITng1Lh TM79FTs6hYnA5piUzoP5uPP7gPZD6Lv+Awq++fyFkZi8dEf1p7d5TKc/VRwj71NU/ULF zs87oh64J/u9V0G5qtxCoNa+eCreV11lW6mSRUSghORdi82eGdQ0OaUTUH/ZmdiAjMIx msQPTb2eny5FxH470+w5O047VlpuapUqrzMF7/hI6JneC1SUyoy8IHQXcmjJUlG9hMv/ gTrQ== MIME-Version: 1.0 X-Received: by 10.107.160.141 with SMTP id j135mr9731796ioe.43.1431658577264; Thu, 14 May 2015 19:56:17 -0700 (PDT) In-Reply-To: References: <5554c318$0$12999$c3e8da3$5496439d@news.astraweb.com> <55554ddb$0$12995$c3e8da3$5496439d@news.astraweb.com> Date: Fri, 15 May 2015 12:56:17 +1000 Subject: Re: Survey -- Move To Trash function in Python? From: Chris Angelico Cc: Python Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1431658586 news.xs4all.nl 2853 [2001:888:2000:d::a6]:53576 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 4447 X-Received-Body-CRC: 3807275246 Xref: csiph.com comp.lang.python:90643 On Fri, May 15, 2015 at 12:49 PM, Ian Kelly wrote: > On May 14, 2015 7:55 PM, "Chris Angelico" wrote: >> (Though when >> it comes to the bikeshedding phase, I'm sure there'll be some who say >> "if it can't be trashed, just hard delete it", and others who say "if >> it can't be trashed, raise an exception". And neither is truly wrong.) > > The answer is "raise an exception". Moving to trash and deleting are > different operations, and one shouldn't be substituted for the other any > more than a failed attempt to create a hard link should create a soft link > instead. > > If the user wants, they can catch the exception and delete the file instead. > Recovering from an accidental deletion would be more difficult. Yes, but sometimes it's at the file system's discretion - particularly when you're working with network mounts. The application may not even know that the file got hard deleted. ChrisA