# Revision history [back]

As far as n is in the global namespace, the error message of your example is misleading. My example below gives the error message:

NameError: global name 'k' is not defined

def T(k):
top = ceil(math.sqrt(k))
print top

@interact
def _(k=6739815371):
timeit('T(k)')


So timeit apparently looks in the global namespace.

My first try was:

@interact
def _(k=6739815371):
global k
timeit('T(k)')


Traceback (most recent call last): def _(k=6739815371): File "", line 1, in <module> File "/tmp/tmpVWF0nv/___code___.py", line 8 @interact SyntaxError: name 'k' is local and global

So we have to outwit the @interact function:

@interact
def _(k0=6739815371):
global k
k = k0
timeit('T(k)')