Skip to content

Commit

Permalink
perf: improve Array initialisation performance
Browse files Browse the repository at this point in the history
  • Loading branch information
agoose77 committed Sep 14, 2022
1 parent b5545a8 commit 9ea085d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/awkward/_v2/highlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,7 @@ def __getattr__(self, where):
Note that while fields can be accessed as attributes, they cannot be
*assigned* as attributes. See #ak.Array.__setitem__ for more.
"""
if where in dir(type(self)):
if hasattr(type(self), where):
return super().__getattribute__(where)
else:
if where in self._layout.fields:
Expand Down Expand Up @@ -1135,7 +1135,7 @@ def __setattr__(self, name, value):
to add or modify a field.
"""
if name in dir(type(self)) or name.startswith("_"):
if name.startswith("_") or hasattr(type(self), name):
super().__setattr__(name, value)
elif name in self._layout.fields:
raise ak._v2._util.error(
Expand Down Expand Up @@ -1816,7 +1816,7 @@ def __getattr__(self, where):
* the field name is not a valid Python identifier or is a Python
keyword.
"""
if where in dir(type(self)):
if hasattr(type(self), where):
return super().__getattribute__(where)
else:
if where in self._layout.fields:
Expand Down

0 comments on commit 9ea085d

Please sign in to comment.