Ulrich wrote: > if I replace it to > def attributelist(self): > # find all attributes to the class that are of type numpy > arrays: > return [attr for attr in dir(self) if > isinstance(getattr(self, attr), numpy.ndarray)] > > it crashes going into some kind of endless loop. > > Do you happen to have any idea?
dir(self) finds an attribute named "attributelist", getattr(self, "attributelist") then tries to calculate the value of that attribute, invokes dir(self) which finds an attribute named "attributelist" and so on ad infinitum or the stack overflows. Try (untested) @property def attributelist(self): return [attr for attr in dir(self) if attr != "attributelist" and isinstance(getattr(self, attr), numpy.ndarray)] to avoid the infinite recursion. -- http://mail.python.org/mailman/listinfo/python-list