forked from rdemaria/pysixtrack
-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
... otherwise Line.append_element does not work.
line = pysixtrack.elements.Line()
line.append_element(
pysixtrack.elements.Multipole(knl=[0, 1e-2]),
'multipole')
... throws a
AttributeError Traceback (most recent call last)
<ipython-input-22-7a02c560d482> in <module>
3 line.append_element(
4 pysixtrack.elements.Multipole(knl=[0, 1e-2]),
----> 5 'multipole')
6 line.append_element(
7 pysixtrack.elements.DriftExact(length=1),
~/gsi/git/pysixtrack/pysixtrack/line.py in append_element(self, element, name)
83
84 def append_element(self, element, name):
---> 85 self.elements.append(element)
86 self.element_names.append(name)
87 # assert len(self.elements) == len(self.element_names)
AttributeError: 'tuple' object has no attribute 'append'
... while initialising the kwargs elements and element_names with empty List instances instead of the default empty Tuple instances resolves the problem:
pysixtrack.elements.Line(elements=[], element_names=[])
Metadata
Metadata
Assignees
Labels
No labels