get TypeError when i import my own .py file
<p>I am doing a sort program.i have two files called bubble(a bubble sort program) and cal_time(calculate the time),and they are in the same directory.</p>

<p>The problem is ,bubble work alone fluently.   however,when i import bubble to my cal_time file and callback bubble sort,the interpreter show me the error message,and obviously there is no built_in function or method in my code:</p>

<blockquote>
<pre><code>Traceback (most recent call last):    
  File "F:/alogrithm/wzysort/cal_time.py", line 13, in &lt;module&gt;  
      bubble.bubble_sort(generate_random_list())  
  File "F:\alogrithm\wzysort\bubble.py", line 4, in bubble_sort  
       if a[indx] &gt; a[indx+1]:  
    TypeError: unorderable types: builtin_function_or_method() &gt; builtin_function_or_method()
</code></pre>
</blockquote>

<p>cal_time.py:</p>

<pre><code>import time
from wzysort import bubble
import random


def generate_random_list():
    result = []
    for i in range(10):
        result.append(random.random)
    return result

time_start = time.time()
bubble.bubble_sort(generate_random_list())
time_end = time.time()
print(time_end - time_start)
</code></pre>

<p>bubble.py:</p>

<pre><code>def bubble_sort(a):
for i in range(len(a)-1):
    for indx in range(len(a[:-i-1])):
        if a[indx] &gt; a[indx+1]:
            a[indx], a[indx + 1] = a[indx + 1], a[indx]
</code></pre>

<p>Your issue lies here:</p>

<pre><code>result.append(random.random)
</code></pre>

<p>You are appending the method <code>random.random</code> onto the list âÂ which has the type <code>builtin_function_or_method</code> (thus resulting in the error you are receiving â how would you compare functions?).</p>

<p>Instead, you want to call the method:</p>

<pre><code>result.append(random.random())
</code></pre>

python module