Message159017
Thanks for relaunching this!
> I'm not sure I understand why this was moved to shutil.open. It seems appropriate to try to accomplish what
> os.startfile() does in a cross-platform way. Don't many of the other os.* calls do this--check os.name and
> then "do the right thing".
They don’t. The os module is a thin wrapper on top of system functions. Cross-platform compat is not achieved with os.name checks but with platform-specific code in the C files. As Windows provides a call named startfile, it is exposed. When we want to provide a higher-level API on top of system calls, we use other modules such as shutil.
> fix minor shutil.disk_usage() doctext typo
Would you report this on another bug report or simply with a mail to the docs@python.org mailing list? Thanks.
> Name changed from shutil.open to shutil.launch due to namespace conflict with open() builtin within the shutil
> module and for users that do from shutil import *
I don’t think these are good arguments. A lot of modules expose a function named open: tarfile, codecs, tokenize... Python has namespaces, let’s use them. The argument about import * is not strong either in my opinion, because all our docs recommend against this idiom.
One argument against open is that the other open functions I mention above return a file object, like the builtin open. With this in mind I agree that a better name should be found. I dislike launch though because it brings to my mind the idea of running/executing a program, not opening it in the appropriate program. |
|
Date |
User |
Action |
Args |
2012-04-23 13:58:39 | eric.araujo | set | recipients:
+ eric.araujo, pitrou, vstinner, giampaolo.rodola, benjamin.peterson, ganadist, Arfrever, r.david.murray, cvrebert, rosslagerwall, Roman.Evstifeev, Hobson.Lane |
2012-04-23 13:58:39 | eric.araujo | set | messageid: <1335189519.14.0.0959687899532.issue3177@psf.upfronthosting.co.za> |
2012-04-23 13:58:38 | eric.araujo | link | issue3177 messages |
2012-04-23 13:58:38 | eric.araujo | create | |
|