On Wed, May 26, 2021 at 10:53 PM Shreyan Avigyan <[email protected]> wrote: > > I've already given one. Since Python is dynamically typed changing a critical > variable can cause huge instability. Want a demonstration? Here we go, > > import sys > sys.stdout = None > > Now what? Now how can we print anything? Isn't this a bug? There are lots of > code out there where we need to protect things from being overwritten. Though > I'm never telling to use constants in Python stdlib or else I could have > never done this demonstration. :) >
A bug? Python did exactly what it should (with the possible exception, pun intended, that there could be an issue with None not being writable). That module attribute exists specifically to be overwritten. Are you saying that this should be a constant? This isn't "instability". This is the interpreter doing exactly what you told it to. Plus - this wouldn't even apply to the proposal as given, which doesn't affect module assignment, only assignment to globals. If this is the best justification you can give, I don't think this proposal is very strong. ChrisA _______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/ZTHNQH227I3PXB6HZCUGJJLCEIAJG5QF/ Code of Conduct: http://python.org/psf/codeofconduct/
