Return a brief representation of this span by only listing contiguous spans and not all items. For example: >>> Span([1, 2, 3, 4, 5, 7, 8, 9, 10]) Span(1, 5)|Span(7, 10)
(self)
| 155 | return Span(self._set.difference(*[o._set for o in others])) |
| 156 | |
| 157 | def __repr__(self): |
| 158 | """ |
| 159 | Return a brief representation of this span by only listing contiguous |
| 160 | spans and not all items. |
| 161 | |
| 162 | For example: |
| 163 | >>> Span([1, 2, 3, 4, 5, 7, 8, 9, 10]) |
| 164 | Span(1, 5)|Span(7, 10) |
| 165 | """ |
| 166 | subspans_repr = [] |
| 167 | for subs in self.subspans(): |
| 168 | ls = len(subs) |
| 169 | if not ls: |
| 170 | subspans_repr.append('Span()') |
| 171 | elif ls == 1: |
| 172 | subspans_repr.append('Span(%d)' % subs.start) |
| 173 | else: |
| 174 | subspans_repr.append('Span(%d, %d)' % (subs.start, subs.end)) |
| 175 | return '|'.join(subspans_repr) |
| 176 | |
| 177 | def __contains__(self, other): |
| 178 | """ |