Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!newsreader4.netcologne.de!news.netcologne.de!bcyclone03.am1.xlned.com!bcyclone03.am1.xlned.com!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.044 X-Spam-Evidence: '*H*': 0.91; '*S*': 0.00; 'subject:Python': 0.06; 'subject: -- ': 0.07; '"if': 0.09; 'deletion': 0.16; 'phase,': 0.16; 'subject:Move': 0.16; 'substituted': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'email addr:gmail.com>': 0.22; 'instead.': 0.24; "shouldn't": 0.24; '>': 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; "can't": 0.35; 'received:google.com': 0.35; '14,': 0.36; 'subject:?': 0.36; 'should': 0.36; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'moving': 0.39; 'delete': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'catch': 0.60; 'deleting': 0.60; 'truly': 0.60; 'more': 0.64; 'different': 0.65; '2015': 0.84; 'subject:Survey': 0.91 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:to :content-type; bh=8hta59vz46NIL13YrxXJboVmzNviKdgsJ35QPMaqKU8=; b=yLytcH2NMMu113stqdINIjymiiWwC7VC6zQmbjBirNKwS6xS3fbITjNo1oUyt6pJNs Q+65Bsx6ZdbqYjvQYCHB6v4vaazIRbmR4F48HVYNFODy+w2JY3pYXjZ2VvSN4hxPeN9d CGhc2Tv1li+jjQ7iIiz732+IC6RnAGa35bE5+Hl5ISJC+SWWT1scxoQPmx/YU9GzEMOi 7eSmJVTShohgXynKCSyf9ydlTcxa+Pd4RzYpOjdplLlvgtey89Ejz+ON6O3mObnFWsDT x0m+/0gv7TsOc7lck+S+RHTQSPySYmVn8cMe1UWfc8qPO+1B6N4FAC+htEgt0oBbAmVL Xh9g== MIME-Version: 1.0 X-Received: by 10.50.30.69 with SMTP id q5mr10763019igh.11.1431658177002; Thu, 14 May 2015 19:49:37 -0700 (PDT) In-Reply-To: References: <5554c318$0$12999$c3e8da3$5496439d@news.astraweb.com> <55554ddb$0$12995$c3e8da3$5496439d@news.astraweb.com> Date: Thu, 14 May 2015 20:49:36 -0600 Subject: Re: Survey -- Move To Trash function in Python? From: Ian Kelly To: Python Content-Type: multipart/alternative; boundary=047d7bdc1c0c1480d7051615e5c5 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: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1431658180 news.xs4all.nl 2890 [2001:888:2000:d::a6]:50859 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 5000 X-Received-Body-CRC: 1961297318 Xref: csiph.com comp.lang.python:90642 --047d7bdc1c0c1480d7051615e5c5 Content-Type: text/plain; charset=UTF-8 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. --047d7bdc1c0c1480d7051615e5c5 Content-Type: text/html; charset=UTF-8

On May 14, 2015 7:55 PM, "Chris Angelico" <rosuav@gmail.com> 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.

--047d7bdc1c0c1480d7051615e5c5--