Time a function: Difference between revisions

Content added Content deleted
No edit summary
Line 1,928: Line 1,928:


=={{header|Python}}==
=={{header|Python}}==
{{incorrect|Python|cannot import pow}}
Cannot run this on 2.7 or 3.7.3. Added () to print for the latter, also fixed an
IndentationError: unindent does not match any outer indentation level on nothing/identity, but:<br>
ImportError: cannot import name 'pow' from '__main__' (test.py)

Given ''function'' and ''arguments'' return a time (in microseconds) it takes to make the call.
Given ''function'' and ''arguments'' return a time (in microseconds) it takes to make the call.


Line 1,952: Line 1,947:
raise
raise


from math import pow
def nothing(): pass
def nothing(): pass
def identity(x): return x</lang>
def identity(x): return x</lang>