In Java you can define a new class inline using anonymous inner classes. This is useful when you need to rewrite only a single method of the class.
Suppose that you
This is what you would do in Python 3.7
#!/usr/bin/env python3 class ExmapleClass: def exit(self): print('this should NOT print since we are going to override') ExmapleClass= type('', (ExmapleClass,), {'exit': lambda self: print('you should see this printed only')})() ExmapleClass.exit()