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

Andrew Barnert abarnert at yahoo.com
Sun Jan 4 23:06:42 CET 2015

On Jan 4, 2015, at 21:35, Antoine Pitrou <solipsis at pitrou.net> wrote:

> On Mon, 5 Jan 2015 06:25:01 +1000
> Nick Coghlan <ncoghlan at gmail.com> wrote:
>> On 5 Jan 2015 05:25, <random832 at fastmail.us> wrote:
>>> On Fri, Jan 2, 2015, at 20:50, Steven D'Aprano wrote:
>>>> You have a choice of desktop
>>>> environments, which may or may not provide a move-to-trash API,
>>>> including no desktop environment at all. Gnome provides an API for
>>>> moving to trash, but I don't know how well it supports the freedesktop
>>>> standard; KDE supports the freedesktop standard, but I don't know if it
>>>> provides an API that can be called. XFCE has partial support.
>>> I don't see why you need to call an API to the desktop enviroment. The
>>> entire point of the spec is to provide compatibility _between_
>>> implementations on the same filesystem - you can quit gnome and log into
>>> KDE and see the same trash.
>> That compatibility is implemented *by* the desktop environments. Yes, you
>> could write your own, but why would you, when the whole point of providing
>> a standard API would be to integrate more cleanly with the underlying OS.
> For the same reason that we ship a HTTP server while we could integrate
> more cleanly with Apache? :-)

That's an interesting point--but note that Python _also_ has WSGI and various other ways to integrate more cleanly with Apache (and various other web servers). If you just want to put up a simple web service to handle a few users (e.g., as a user interface to your application), SimpleHTTPServer is sometimes the answer. But if you want to add a web service to a major Apache deployment, you generally don't want to do that by deploying SimpleHTTPServer alongside it. It's not _impossible_ to share ports, SSL certs, configs, logs, deployment scripts, monitoring tools, etc. between the two, but it's not the way you'd want to do things. (There's also the fact that SimpleHTTPServer won't be able to handle the same load as Apache…)

> When there's a well-defined spec,

I suppose it depends on your definition of "well-defined spec". As Nick said, XFCE only partly supports the spec, and he's not sure how completely GNOME does. As I pointed out, there are gaps in the spec for both implementation-defined and future-expansion behavior. That isn't the same as the case with HTTP/1.1.

Look at http://www.freedesktop.org/wiki/Software. Notice that xdg-utils does not yet have a trash command, and there is no separate trash program or library. (As far as I know, there are at least two XDG trash programs on github which have not yet been submitted to be part of the XDG software collection, which don't appear to be 100% compatible with each other. (For example, one of them requires top trash directories to have exactly mode 41777, the other just requires them to be executable for the current user and have the sticky bit on.) Does creating a third one--and putting it in the Python stdlib forever--really sound like a good idea?

(As a side note, one of the two above-mentioned trash programs is written in Node, and I don't see anyone suggesting that the functionality be moved into the Node stdlib.)

More information about the Python-ideas mailing list