Re: [Python-ideas] natively logging sys.path modifications
![](https://secure.gravatar.com/avatar/d67ab5d94c2fed8ab6b727b62dc1b213.jpg?s=120&d=mm&r=g)
On Thu, Jun 25, 2015 at 4:26 AM, anatoly techtonik <techtonik@gmail.com> wrote:
That object will be broken if somebody decides to use assignment:
sys.path = []
And as far as I know it is not possible to prevent this case or guard against this replacement.
So what you want is for the sys module to log all assignments to a particular attribute, AND for all mutations of that attribute to be logged as well. That sounds like two completely separate problems to be solved, but neither is fundamentally impossible (although you'd need to fiddle with the sys module itself to do the other). I suggest you investigate ways of solving this that require zero core code changes, as those ways will work on all existing Python versions. Then once you run up against an actual limitation, you'll have a better argument for code changes. ChrisA
participants (1)
-
Chris Angelico