Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Record output of timeit in variable

How can I record in a variable the amount of time taken by a function? I read somewhere that timeit is the good way to time stuff, but it seems to print its output instead of returning it.

Record output of timeit in variable

How can I record in a variable the amount of time taken by a function? I read somewhere that timeit is the good way to time stuff, but it seems to print its output instead of returning it.it. If possible, I would prefer not to redirect streams or redefine print, etc.

Record output of timeit in variable

How can I record in a variable the amount of time taken by a function? I read somewhere that timeit is the good way to time stuff, but it seems to print its output instead of returning it. it.

If possible, I would prefer not to redirect streams or redefine print, etc.

Record output of timeit in variable

How can I record in a variable the amount of time taken by a function? I read somewhere that timeit is the good way to time stuff, but it seems to print its output instead of returning it.

If possible, I would prefer not to redirect streams or redefine print, etc.

EDIT: got it, leaving the question for reference. timeit("blah",seconds=True) returns a number. This should probably get a mention in 'timeit?'.

Record output of timeit in variable

How can I record in a variable the amount of time taken by a function? I read somewhere that timeit is the good way to time stuff, but it seems to print its output instead of returning it.

If possible, I would prefer not to redirect streams or redefine print, etc.

EDIT: got it, leaving the question for reference. reference.

timeit("blah",seconds=True) returns a number. number.

This should probably get a mention in 'timeit?'.

Record output of timeit in variable

How can I record in a variable the amount of time taken by a function? I read somewhere that timeit is the good way to time stuff, but it seems to print its output instead of returning it.

If possible, I would prefer not to redirect streams or redefine print, etc.

EDIT: got it, leaving the question for reference.

timeit("blah",seconds=True) returns a number.

This should probably get a mention in 'timeit?'.

Record output of timeit in variable

How can I record in a variable the amount of time taken by a function? I read somewhere that timeit is the good way to time stuff, but it seems to print its output instead of returning it.

If possible, I would prefer not to redirect streams or redefine print, etc.


EDIT: got it, leaving the question for reference.

timeit("blah",seconds=True) returns a number.

This should probably get a mention in 'timeit?'.

click to hide/show revision 8
Please please stop messing up new lines. One shouldn't have to use br.

Record output of timeit in variable

How can I record in a variable the amount of time taken by a function? I read somewhere that timeit is the good way to time stuff, but it seems to print its output instead of returning it.

If possible, I would prefer not to redirect streams or redefine print, etc.


EDIT: got it, leaving the question for reference.

timeit("blah",seconds=True) returns a number.

This should probably get a mention in 'timeit?'.

click to hide/show revision 9
No.9 Revision

Record output of timeit in variable

How can I record in a variable the amount of time taken by a function? I read somewhere that timeit is the good way to time stuff, but it seems to print its output instead of returning it.

If possible, I would prefer not to redirect streams or redefine print, etc.


EDIT: got it, leaving the question for reference.

timeit("blah",seconds=True) returns a number.

number.

This should probably get a mention in 'timeit?'.

click to hide/show revision 10
No.10 Revision

Record output of timeit in variable

How can I record in a variable the amount of time taken by a function? I read somewhere that timeit is the good way to time stuff, but it seems to print its output instead of returning it.

If possible, I would prefer not to redirect streams or redefine print, etc.


EDIT: got it, leaving the question for reference.

timeit("blah",seconds=True) timeit("blah",seconds=True)

returns a number. number.

This should probably get a mention in 'timeit?'.