[Python-ideas] Adding `pathlib.Path` method that would send file to recycle bin

Steven D'Aprano steve at pearwood.info
Wed Dec 31 00:47:03 CET 2014


On Wed, Dec 31, 2014 at 12:12:01AM +0100, Andrew Barnert wrote:

> By "suitable" I mean "suitable for widespread-enough use that it 
> should be in the stdlib". As I said earlier in the thread, I think 
> it's perfectly reasonable to have a third-party library that uses a 
> deprecated API, requires 10.8, requires a runloop, directly or 
> indirectly asks the Finder to do the work for you, or doesn't quite 
> meet Apple's HIG rules, because all of those could be acceptable in 
> _many_ applications; I just don't think any of those should be in the 
> stdlib, because none of those are acceptable in _most_ applications.

What's wrong with asking the Finder to move the file? Under what 
circumstances would that be unacceptable? Are there scenarios on OS X 
where the Finder isn't available but the trash is?

http://www.anthonysmith.me.uk/2008/01/08/moving-files-to-trash-from-the-mac-command-line/

Having to call out to an external program via Applescript feels rather 
icky, but given the difficulty of simultaneously supporting 
multiple OS X versions, satisfying the rules of Apple Store, and using 
Apple's APIs, I don't see any alternative.



-- 
Steve


More information about the Python-ideas mailing list