[Python-ideas] chdir context manager (original) (raw)
Guido van Rossum guido at python.org
Sat Jan 19 19:06:41 CET 2013
- Previous message: [Python-ideas] chdir context manager
- Next message: [Python-ideas] chdir context manager
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
AFAICT shutil.make_archive() already has all the information it needs to be able to do it sjob without using chdir -- it's just being lazy.
On Sat, Jan 19, 2013 at 9:40 AM, Terry Reedy <tjreedy at udel.edu> wrote:
On 1/19/2013 9:57 AM, Nick Coghlan wrote:
-1 from me I consider caring about the current directory to be an anti-pattern - paths should be converted to absolute ASAP, and for invocation of other tools that care about the current directory, that's why the subprocess APIs accept a "cwd" argument. I certainly don't want to encourage people to unnecessarily rely on global state by providing a standard library context manager that makes it easier to do so. Are you suggesting then that stdlib functions, such as archive makers, should 1) not require any particular setting of cwd but should have parameters that allow all paths to passed as absolute paths, and 2) not change cwd? If so, then shutil.makearchive should be able to pass absolute source and target paths to the archive makers, rather than having to set cwd before calling them. -- Terry Jan Reedy
Python-ideas mailing list Python-ideas at python.org http://mail.python.org/mailman/listinfo/python-ideas
-- --Guido van Rossum (python.org/~guido)
- Previous message: [Python-ideas] chdir context manager
- Next message: [Python-ideas] chdir context manager
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]