I receive a namespace object from command line arguments. And I don\'t want to modify it. Can I do that or do you have some ideas?
# -*- coding: utf-8 -*-
impo
You can redefine __setattr__
in your mutable_namespace:
class NotMutableException(Exception):pass
class SomeObject(object):
def init(self):
self.x = 10
self.y = 20
some_obj = SomeObject()
some_obj.z = 30
def not_setattr(self, name, value):
raise NotMutableException
type(some_obj).__setattr__ = not_setattr
some_obj.a = 1000