Let's suppose that Parent
class is:
class Parent:
def __init__(self, a):
self.a = a
def do_something(self):
a = self.a
b = self.a
print('The a is ', a)
print('The b is ', b)
I want to create a Child
class that will redefine only b
Something like:
class Child(Parent):
def do_something(self, custom_param):
@some_exotic_decorator_or_something_else(b=custom_param)
super().do_something()
And get output like:
obj = Child('the_a')
obj.do_something('the_b')
The a is the_a
The b is the_b
Of course original method has many lines and complicated logic to override whole method. Also that is one of common python libraries so I want to minimise intrusion inside method.
Here is any common way in python to do that?
To be more clear, the method what I want to override is _write_end_record
I want to redefine only centDirOffset
. All other logic is working good. I may copy and paste whole method inside my code and change only one line, but it don't looking like a smart idea