| 48 | |
| 49 | |
| 50 | class NodeList(list): |
| 51 | __slots__ = () |
| 52 | |
| 53 | def item(self, index): |
| 54 | if 0 <= index < len(self): |
| 55 | return self[index] |
| 56 | |
| 57 | def _get_length(self): |
| 58 | return len(self) |
| 59 | |
| 60 | def _set_length(self, value): |
| 61 | raise xml.dom.NoModificationAllowedErr( |
| 62 | "attempt to modify read-only attribute 'length'") |
| 63 | |
| 64 | length = property(_get_length, _set_length, |
| 65 | doc="The number of nodes in the NodeList.") |
| 66 | |
| 67 | # For backward compatibility |
| 68 | def __setstate__(self, state): |
| 69 | if state is None: |
| 70 | state = [] |
| 71 | self[:] = state |
| 72 | |
| 73 | |
| 74 | class EmptyNodeList(tuple): |
searching dependent graphs…