Is it possible to escape a reserved word in Python?

前端 未结 5 1587
一整个雨季
一整个雨季 2020-12-18 04:36

It may not be a good idea to name a variable after a reserved word, but I am curious:

Is there any escape syntax in Python to allow you to use a reserved word as the

5条回答
  •  遥遥无期
    2020-12-18 05:20

    If you don't mind prefixing, you can "prefix" with an underscore. Sure it'll actually be part of the variable's name, but it'll look like a prefixed reserved word. Other than that, it is not possible.

提交回复
热议问题