
On Thu, Jan 1, 2015 at 9:37 PM, Ram Rachum <ram@rachum.com> wrote:
As much as I don't like having functionality that's only available on certain OSs, it makes more sense than depriving Windows users of functionality that they could be using just because Mac doesn't support it. (And of course, Python has lots of OS-specific modules.)
Most OS-specific stuff is in the os module, but path handling is inherently platform-specific to some extent, so either place would be reasonable.
So maybe we can add a function to the `os` module that sends a file to the recycle bin, and a constant that will say whether the current OS supports this? Then we could have code like this:
if os.RECYCLE_BIN_SUPPORT: os.recycle(my_file) else: os.remove(my_file)
What do you think?
Or: try: delete = os.recycle except AttributeError: delete = os.remove delete(my_file) ChrisA