Skip to content

Commit 82a5b77

Browse files
fix start_index/stop_index issues
1 parent 26ea58b commit 82a5b77

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

superstring/superstring.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ def split(self, separator = " "):
3535

3636
def substring(self, start_index, end_index=None):
3737
# TODO: if the substring is to short: copys
38-
start_index = start_index if start_index else 0
39-
end_index = end_index if end_index else self.length()
38+
start_index = start_index if start_index is not None else 0
39+
end_index = end_index if end_index is not None else self.length()
4040
if start_index == 0 and end_index == self.length():
4141
return self
4242
if end_index - start_index < SUPERSTRING_MINIMAL_LENGTH:
@@ -88,8 +88,8 @@ def character_at(self, index):
8888
return self._content[index]
8989

9090
def to_printable(self, start_index=None, end_index=None):
91-
start_index = start_index if start_index else 0
92-
end_index = end_index if end_index else self.length()
91+
start_index = start_index if start_index is not None else 0
92+
end_index = end_index if end_index is not None else self.length()
9393
return self._content[start_index:end_index]
9494

9595

@@ -108,8 +108,8 @@ def character_at(self, index):
108108
return self._right[index - left_len]
109109

110110
def to_printable(self, start_index=None, end_index=None):
111-
start_index = start_index if start_index else 0
112-
end_index = end_index if end_index else self.length()
111+
start_index = start_index if start_index is not None else 0
112+
end_index = end_index if end_index is not None else self.length()
113113
left_len = self._left.length()
114114
if end_index < left_len:
115115
return self._left.to_printable(start_index=start_index, end_index=end_index)

0 commit comments

Comments
 (0)