can you recover from reassigning __builtins__ in python?

后端 未结 3 2141
栀梦
栀梦 2020-12-09 03:09

If I open up interactive mode and type:

__builtins__ = 0 # breaks everything

have I completely broken the session? If so, what is going on

3条回答
  •  清歌不尽
    2020-12-09 03:29

    You're right; you can practically break a Python session. I doubt there's a way to completely destroy it - seeing Ned's answer was quite the revelation to me.

    Being a very dynamic language, Python gives you a lot of rope to hang yourself with. Don't look at this as a flaw, though; a common Python slogan states that "we're all consenting adults here." If you understand the language and really know what you're doing, you have an insane amount of control over basically every aspect of Python.

提交回复
热议问题