'int' object is not callable when using groupby
<p>I am trying to find the longest sequence of numbers in a list using the following code</p>

<pre><code>from itertools import groupby
ggg = groupby([1,2,3,3,3,5,88,9,9,9,9,9,9,9,1,1,1,2,2,3,3,3,3,3])
max(ggg, key=lambda k: len(list(k[1])))
</code></pre>

<p>However, I get the error 'int' object is not callable.  Additionally, I am using python 3. </p>

<p>The code works fine for me:</p>

<pre><code>&gt;&gt;&gt; from itertools import groupby
&gt;&gt;&gt; ggg = groupby([1,2,3,3,3,5,88,9,9,9,9,9,9,9,1,1,1,2,2,3,3,3,3,3])
&gt;&gt;&gt; max(ggg, key=lambda k: len(list(k[1])))
(9, &lt;itertools._grouper object at 0x019973F0&gt;)
</code></pre>

<p>As @FamousJameous mentioned, it appears that one of the functions you are using has been assigned to an integer. This is a great illustration of why you should be <strong>careful with what variable names you choose</strong>, since they can wipe away existing functions. Consider:</p>

<pre><code>&gt;&gt;&gt; x = [1,2,3]
&gt;&gt;&gt; len = len(x)
&gt;&gt;&gt; len(x)
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
TypeError: 'int' object is not callable
</code></pre>

python