On Mon, Apr 11, 2022 at 12:21:41PM +1000, Chris Angelico wrote:
> On Mon, 11 Apr 2022 at 10:41, Steven D'Aprano <st...@pearwood.info> wrote:
> >
> > On Sat, Apr 09, 2022 at 02:52:50AM +1000, Chris Angelico wrote:
> >
> > > We aren't bothered by the fact that os.chdir()
> > > is global, we just accept that it belongs to the application, not a
> > > library.
> >
> > You might not be, but those of us who use it, or *would* use it if it
> > wasn't so dangerous, think differently.
> 
> Would you? What would the behaviour of os.chdir be if it had module
> scope? Please explain, I am very curious.

You know how every OS process has its own working directory? Just like 
that, except every module.

Its probably too hard to implement in Python, at least for the benefit. 
(Lots of effort, only a small benefit, nett negative worth.) 
Especially since we would probably want the WD to use dynamic scoping, 
not lexical scoping.

This is not a PEP proposing per-module WDs, not even a serious proposal 
for it. "One WD per process" is baked so deep into file I/O on Posix 
systems (and I presume Windows) that its probably impossible to 
implement in current systems.



-- 
Steve
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/M4MOTLBRAKUPQPJPSASZGE4B2FKYSFOG/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to