block dynamic attribute creation

Alan G Isaac alan.isaac at gmail.com
Thu Feb 19 16:20:25 CET 2009


>>        if hasattr(self, attr): #update val
>>          self.__dict__[attr] = val


On 2/19/2009 3:54 AM Gabriel Genellina apparently wrote:
> In particular, your code prevents using class attributes as a default
> value for instance attributes

Doesn't the above allow that?

Thanks,
Alan



More information about the Python-list mailing list