Skip to content

Commit 6d52df5

Browse files
committed
Adding note about using _self as first param to class method.
1 parent c0b55c0 commit 6d52df5

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

intercom/traits/api_resource.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,16 @@ def to_datetime_value(value):
3434

3535
class Resource(object):
3636

37-
def __init__(_self, **params):
37+
def __init__(_self, **params): # noqa
38+
# intercom includes a 'self' field in the JSON, to avoid the naming
39+
# conflict we go with _self here
3840
_self.changed_attributes = []
3941
_self.from_dict(params)
40-
self = _self
4142

4243
if hasattr(_self, 'flat_store_attributes'):
43-
for attr in self.flat_store_attributes:
44-
if not hasattr(self, attr):
45-
setattr(self, attr, FlatStore())
44+
for attr in _self.flat_store_attributes:
45+
if not hasattr(_self, attr):
46+
setattr(_self, attr, FlatStore())
4647
_self.changed_attributes = []
4748

4849
def _flat_store_attribute(self, attribute):

0 commit comments

Comments
 (0)