Imagine I have a Python descriptor :
class MyDesc(object): def __get__(self, instance, instance_type=None): return 'Blue berries' def __set__(self, instance, value): print 'called with', instance, value class MyClass(object): desc = MyDesc()
Is there a way in the normal run of things that tar __set__ will be called with None for the instance argument? I mean, not doing something like
MyClass.__dict__['desc'].__set__(None, 'ants bees cats')
It doesn't look like this:
MyClass.desc = 'blah' setattr(MyClass, 'desc', 'blah')
The reason I ask is to see the security coding in Django to avoid this scenario, and I wonder if this is necessary.
source share