>>> setattr(None, 'foo', 'bar') Traceback (most recent call last): File "", line 1, in AttributeError: 'NoneType' object has no attribute 'foo'