diff --git a/field.py b/field.py index 28272f4cdcbcfc5cccace1a2f03f8501facade88..18ea09dafc997cec4f129fb507e278bd0e0f8465 100644 --- a/field.py +++ b/field.py @@ -239,6 +239,11 @@ class Field: def __getitem__(self, *idx): return self.__call__(*idx) + def __iter__(self): + """This is necessary to work with parts of sympy that test if an object is iterable (e.g. simplify). + The __getitem__ would make it iterable""" + raise TypeError("Field access is not iterable") + @property def field(self): return self._field