'int' object is not callable error in class
<p>In python 2.7, I am writing a class called <code>Zillion</code>, which is to act as a counter for very large integers. I believe I have it riddled out, but I keep running into <code>TypeError: 'int' object is not callable</code> , which seems to mean that at some point in my code I tried to call an <code>int</code> like it was a function. Many of the examples I found on this site were simply a mathematical error where the writer omitted an operator. I can't seem to find my error.</p>

<pre class="lang-none prettyprint-override"><code>Traceback (most recent call last):
  File "&lt;pyshell#3&gt;", line 1, in &lt;module&gt;
    z.increment()
TypeError: 'int' object is not callable
</code></pre>

<p>My code:</p>

<pre><code>class Zillion:
    def __init__(self, digits):
        self.new = []
        self.count = 0 # for use in process and increment
        self.increment = 1 # for use in increment
        def process(self, digits):
            if digits == '':
                raise RuntimeError
            elif digits[0].isdigit() == False:
                if digits[0] == ' ' or digits[0] == ',':
                    digits = digits[1:]
                else:
                    raise RuntimeError
            elif digits[0].isdigit():
                self.new.append(int(digits[0]))
                digits = digits[1:]
                self.count += 1
            if digits != '':
                    process(self, digits)
        process(self, digits)
        if self.count == 0:
            raise RuntimeError

        self.new2 = self.new  # for use in isZero

    def toString(self):
        self.mystring =''
        self.x = 0
        while self.x &lt; self.count:
            self.mystring = self.mystring + str(self.new[self.x])
            self.x += 1
        print(self.mystring)

    def isZero(self):
        if self.new2[0] != '0':
            return False
        elif self.new2[0] == '0':
            self.new2 = self.new2[1:]
            isZero(self)
        return True

    def increment(self):
        if self.new[self.count - self.increment] == 9:
            self.new[self.count - self.increment] = 0
            if isZero(self):
                self.count += 1
                self.new= [1] + self.new
            else:
                self.increment += 1
                increment(self)
        elif self.new[self.count - self.increment] != 9:
            self.new[self.count - self.increment] = self.new[self.count - self.increment] + 1
</code></pre>

<p>You have defined an instance variable in <code>Zillion.__init__()</code></p>

<pre><code>def __init__(self, digits):
        self.new = []
        self.count = 0 
        self.increment = 1 # Here!
</code></pre>

<p>Then you defined a method with the same name 'Zillion.increment()`:</p>

<pre><code>def increment(self):
    [â¦]
</code></pre>

<p>So if you try to call your method like this:</p>

<pre><code>big_number = Zillion()
big_number.increment()
</code></pre>

<p><code>.Ã¬ncrement</code> will be the integer you have defined in <code>.__init__()</code> and not the method.</p>

python