I am designing an API which mostly involves refactoring the original code.
So Right now I have a method which has two big chunks which are seperated by an If-else condition, which in my opinion is not exactly the best idea.
The code looks like
do_something():
if (isTrue):
#Large block of statements.
else:
#another large block of statements.
The reason I have them both under a single function is because both the chunks do the same thing but with some slight variations, which introduces the ugly if-else block.
I wanted to know what would be the best idea to refactor this code in a better way, if it is possible to do that using OOP, that would be even better.
I am not going with the obvious defining two methods way because at the moment both the chunks are doing the same thing.