can you recover from reassigning __builtins__ in python?

后端 未结 3 2142
栀梦
栀梦 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:54

    Basically messing with protected and reserved names means breaking your session, sometimes without a way to recover from.

    For example, you can type in shell:

    True = False # The chaos begins!
    

    These are not possible with other programming languages, but python lets you do what you want, even if it'll break everything.

提交回复
热议问题