Skip to content

Instantly share code, notes, and snippets.

@lapis-zero09
Created February 16, 2019 16:39
Show Gist options
  • Save lapis-zero09/23db6b3066264d024761ea34f03f0d48 to your computer and use it in GitHub Desktop.
Save lapis-zero09/23db6b3066264d024761ea34f03f0d48 to your computer and use it in GitHub Desktop.
import sys
class Const:
def __setattr__(self, name, value):
if name in self.__dict__:
raise TypeError("Can't rebind const (%s)" % name)
self.__dict__[name] = value
sys.modules[__name__] = Const()
@lapis-zero09
Copy link
Author

2019-02-17 1 39 49

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment