Split a name into a prefix and suffix names at the specified depth. *depth* is an ``int`` specifying the number of labels in the suffix Raises ``ValueError`` if *depth* was not >= 0 and <= the length of the name. Returns the tuple ``(prefix, suffix)``.
(self, depth: int)
| 752 | return self.relativize(other) |
| 753 | |
| 754 | def split(self, depth: int) -> Tuple["Name", "Name"]: |
| 755 | """Split a name into a prefix and suffix names at the specified depth. |
| 756 | |
| 757 | *depth* is an ``int`` specifying the number of labels in the suffix |
| 758 | |
| 759 | Raises ``ValueError`` if *depth* was not >= 0 and <= the length of the |
| 760 | name. |
| 761 | |
| 762 | Returns the tuple ``(prefix, suffix)``. |
| 763 | """ |
| 764 | |
| 765 | l = len(self.labels) |
| 766 | if depth == 0: |
| 767 | return (self, dns.name.empty) |
| 768 | elif depth == l: |
| 769 | return (dns.name.empty, self) |
| 770 | elif depth < 0 or depth > l: |
| 771 | raise ValueError("depth must be >= 0 and <= the length of the name") |
| 772 | return (Name(self[:-depth]), Name(self[-depth:])) |
| 773 | |
| 774 | def concatenate(self, other: "Name") -> "Name": |
| 775 | """Return a new name which is the concatenation of self and other. |