f | class NegExt: | f | class NegExt: |
| | | |
| def __neg__(self): | | def __neg__(self): |
t | my_mro = self.__class__.mro() | t | mro = self.__class__.mro() |
| parent = my_mro[my_mro.index(NegExt) + 1] | | parent = mro[mro.index(NegExt) + 1] |
| try: | | try: |
| return self.__class__(parent.__neg__(self)) | | return self.__class__(parent.__neg__(self)) |
| except Exception: | | except Exception: |
| try: | | try: |
| return self.__class__(self[1:-1]) | | return self.__class__(self[1:-1]) |
| except Exception: | | except Exception: |
| return self.__class__(self) | | return self.__class__(self) |