block dynamic attribute creation

Alan G Isaac alan.isaac at
Thu Feb 19 19:42:19 CET 2009

On 2/19/2009 3:47 AM Bruno Desthuilliers apparently wrote:
>       if not hasattr(self, attr) and getattr(self, '_attrlock', False):
>         raise AttributeError(yadda yadda)
>       # NB: assume newstyle class
>       super(YourClass, self).__setattr__(attr, val)

PS Thanks also to all who restrained
themselves from saying, "don't do this".

More information about the Python-list mailing list