Commit bebb419f authored by Simeon Doetsch's avatar Simeon Doetsch

__getattr__ instead of __getattribute__

parent b5e7162f
......@@ -44,13 +44,9 @@ class PlutoData(object):
self.n, self.t, self.dt, self.nstep = n, parent.t[n], parent.dt[n], parent.nstep[n]
def __getattribute__(self, name):
def __getattr__(self, name):
"""Get grid/data attributes from corresponding dict, or load it"""
# normal attributes
try:
return object.__getattribute__(self, name)
except AttributeError:
pass
# grid
try:
return object.__getattribute__(self, 'grid')[name]
......
......@@ -33,13 +33,7 @@ class Simulation:
# dict for individual data frames
self._data = {}
def __getattribute__(self, name):
# normal attributes
try:
return object.__getattribute__(self, name)
except AttributeError:
pass
def __getattr__(self, name):
# grid
try:
return object.__getattribute__(self, 'grid')[name]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment