|
|
|
|
|
by marcianx
683 days ago
|
|
I immediately see the logic in this API. When slicing, I look at indexes as being between elements or at the start (0) or end (length). This gives an in-bounds starting index between 0 and length, inclusive. So if the starting index is in bounds, you get a substring. If it's not, you get no result. And your answer for Python is not quite correct: "" is falsy in Python, and both of the last two when translated to Python give "null". |
|