Q:

OOP code works fine in Python 3.6 but in Python 2.7 throws max recursion depth runtime error

I am trying to implement the __gt__ method in Python 2.7 in my class but I seemed am receiving a run time error. 
class FoodProduct:
    def __init__(self, name, price, weight, vitamins):
        self.name=name
        self.price=price
        self.weight=weight
        self.vitamins=vitamins

    def get_vitamins_num(self):
        count=0
        for i in range(len(self.vitamins)):
            if self.vitamins[i]=="1":
                count+= 1
        return count

    def __gt__(self,other):
        if self.price < other.price:
            return True
        elif self.price > other.price:
            return False
        else:
            if self.get_vitamins_num > other.get_vitamins_num:
                return True
            else:
                return False

My code is not recursive, so I am puzzled by this error.
Also, When I tried to run it on Python 3.6 it worked just fine.
As I mainly use Python 3, I checked and confirmed the that indeed __gt__ is supposed to work on python 2.7
Could anyone please help and explain what might be the problem, and maybe why it happens only on Python 2.7?
Thanks!

A:

You need to call the methods listed in the else block:
self.get_vitamins_num() > other.get_vitamins_num():

In full:
def __gt__(self,other):
    if self.price < other.price:
        return True
    elif self.price > other.price:
        return False
    else:
        if self.get_vitamins_num() > other.get_vitamins_num():
            return True
        else:
            return False

