[Python-ideas] chdir context manager
Vinay Sajip
vinay_sajip at yahoo.co.uk
Sat Jan 19 18:29:33 CET 2013
Nick Coghlan <ncoghlan at ...> writes:
>> -1 from me
>> I consider caring about the current directory to be an anti-pattern
I would agree, but in some places we unfortunately have to care about this,
because of stdlib history - for example, distutils. Wherever you have to do
"python setup.py ..." there is an implicit assumption that anything setup.py
looks at will be relative to wherever the setup.py is - it's seldom invoked
as "python /path/to/setup.py", and from what I've seen, very few projects
do the right thing in their setup.py and code called from it in terms of
getting an absolute path for the directory setup.py is in, and then using it
in subsequent operations.
I agree that we shouldn't encourage this kind of behaviour :-)
Regards,
Vinay Sajip
More information about the Python-ideas
mailing list