f | class NegExt: | f | class NegExt: |
| | | |
| def __neg__(self): | | def __neg__(self): |
| if hasattr(super(), '__neg__'): | | if hasattr(super(), '__neg__'): |
| try: | | try: |
| return self.__class__(super().__neg__()) | | return self.__class__(super().__neg__()) |
n | except SyntaxError: | n | except TypeError: |
| pass | | pass |
n | if hasattr(super(), '__getitem__'): | n | if hasattr(self, '__getitem__'): |
| try: | | try: |
| return self.__class__(self[1:-1]) | | return self.__class__(self[1:-1]) |
t | except KeyError: | t | except Exception: |
| pass | | pass |
| return self.__class__(self) | | return self.__class__(self) |