[Python-ideas] shutil.launch / open/ startfile

Ethan Furman ethan at stoneleaf.us
Mon Apr 23 21:51:19 CEST 2012


Hobson Lane wrote:
> Formatted and finished Rebert's solution to this issue
> 
> http://bugs.python.org/issue3177
> 
> But the question of where to put it is still open ( shutil.open vs. 
> shutil.launch vs. os.startfile ):
> 
> 1. `shutil.open()` will break anyone that does `from shutil import *` or 
> edits the shutil.py file and tries to use the builtin open() after the 
> shutil.open() definition.

`from ... import *` should not be used with any module that does not 
explicitly support it, and shutil does not.

How often do people modify library modules?


> 2. `shutil.launch()` is better than shutil.open() due to reduced 
> breakage, but not as simple or DRY or reverse-compatible as putting it 
> in os.startfile() in my mind. This fix just implements the functionality 
> of os.startfile() for non-Windows OSes.

+1 for shutil.launch()

~Ethan~



More information about the Python-ideas mailing list