I love the walrus operator - and use it quite a bit, but, replacing
if hi is None:
hi = len(a)
With: hi ??= len(a)
Just sounds gratuitous. I'm happy this was deferred.