viperleed.calc.classes.atom_containers.AtomList
- class viperleed.calc.classes.atom_containers.AtomList(*atoms, strict=True)[source]
A sequence of Atom objects.
- strict
Whether this AtomList only allows unique .num values. This attribute can temporarily be turned off if atom numbers are made unique later. After .num(s) are unique, it is advisable to restore strict to True and to call update_atoms_map. A strict AtomList has some of its operations optimized for O(1) access.
- Type:
bool
Methods
__init__
(*atoms[, strict])Initialize instance.
append
(value)S.append(value) -- append value to the end of the sequence
clear
()Remove all atoms.
copy
()Return a copy of this AtomList.
count
(value)Return the number of occurrences of value.
extend
(values)S.extend(iterable) -- extend sequence by appending elements from the iterable
get
(num[, default])Return the atom with a given number.
index
(value, *args)Return the index of an atom.
insert
(index, value)Insert a single atom at a given index.
pop
([index])Raise IndexError if list is empty or index is out of range.
remove
(value)S.remove(value) -- remove first occurrence of value.
restore_sorting
([sort_map])Restore a sorting order (or the last one stored).
reverse
()Reverse in place.
save_sorting
()Store the current sorting so it can be later restored.
sort
(*[, key, reverse])Sort this list of atoms.
update_atoms_map
()Refresh the {num: atom} map.
Attributes
n_atoms
Return the number of atoms in this AtomList.