yes, you are probably violating the SRP but in this case I wouldn't care.
I think this is a hard one.
First I tend towards Barry's point of view:
You are really doing "two things" in your class. So, if you take the dictum of "reasons" to change to the letter, you are violating the
But on the other hand: I think breaking this up into a fibonacci-series-producing class and another summing-class is nonsensical.
My personal interpretation of the
Single Responsibility Principle is:
"dealing with one topic". And when objects tend to grow too much, I have to decide, which functions are off-topic and need to be refactored in some way.
If you want: I am advocating a more pragmatically - perhaps not really orthodox position.
In your case that means, if I say "dealing with fibonacci numbers" is our topic and the resulting class results in two "subtopics" generating and summing that is a possible code smell, but more in the future than now.
Don't forget: Those principles weren't developed for their own sake, they were developed with some purposes. And one of those purposes is maintainability.
And as far as you code goes, I tend to say, it is still maintainable.
One last word:
If you really want to improve your code - get rid of the class at all.
I see no reason, why one should write for such a job a class at all - except, perhaps, you are on the one hand obsessed with classes or on the other hand, for educational purposes.
Two simple functions were sufficient.
Python is a decent objectoriented language though, but sometimes it is overhead to write a class for everything. Python is not Java, where it is necessary to write explicit classes for everything. Python is not forcing you to do that.
First take care of writing clean code. Later take care of your overall design. Start with naming. Barry pointed out, that you should name your functions more pythonic. Another point worth mentioning is your function naming in general. Function names should reveal their intention. So what is the intention of
fibonacci_calculator.get_result? Reading this, withouht investigating your code, my answer is: I don't have any clue. I know there are fibonacci numbers involved and somehow there is a
result. How it is claculated: the heck, I do not know. On the other hand:
fibonacci.sum_evens_up_to() clearly says, what it does: it sums up the fibonacci evens up to a paramter given.