Is there a way of hooking str.__getitem__?
Example:
I'd like to be capable of do:
>>> "this is a string"[[1,3,4]]
'hs '
passing a list to [] and get the items in that list.
A more realistic example:
class STR(str):
pass
class INT(int):
pass
It's easy to make that STR("a string")[1]
or STR("a string")[INT(1)]
return an STR instance.
I'd like to be capable to make "a non STR string"[INT(1)]
return an STR instance.