Show More
@@ -195,12 +195,16 b' class ExecutionMagics(Magics):' | |||||
195 |
|
195 | |||
196 | """Run a statement through the python code profiler. |
|
196 | """Run a statement through the python code profiler. | |
197 |
|
197 | |||
198 | Usage, in line mode: |
|
198 | **Usage, in line mode:** | |
|
199 | ||||
199 | %prun [options] statement |
|
200 | %prun [options] statement | |
200 |
|
201 | |||
201 | Usage, in cell mode: |
|
202 | **Usage, in cell mode:** | |
|
203 | ||||
202 | %%prun [options] [statement] |
|
204 | %%prun [options] [statement] | |
|
205 | ||||
203 | code... |
|
206 | code... | |
|
207 | ||||
204 | code... |
|
208 | code... | |
205 |
|
209 | |||
206 | In cell mode, the additional code lines are appended to the (possibly |
|
210 | In cell mode, the additional code lines are appended to the (possibly | |
@@ -1028,12 +1032,17 b' class ExecutionMagics(Magics):' | |||||
1028 | def timeit(self, line='', cell=None, local_ns=None): |
|
1032 | def timeit(self, line='', cell=None, local_ns=None): | |
1029 | """Time execution of a Python statement or expression |
|
1033 | """Time execution of a Python statement or expression | |
1030 |
|
1034 | |||
1031 | Usage, in line mode: |
|
1035 | **Usage, in line mode:** | |
|
1036 | ||||
1032 | %timeit [-n<N> -r<R> [-t|-c] -q -p<P> -o] statement |
|
1037 | %timeit [-n<N> -r<R> [-t|-c] -q -p<P> -o] statement | |
1033 | or in cell mode: |
|
1038 | ||
|
1039 | **or in cell mode:** | |||
|
1040 | ||||
1034 | %%timeit [-n<N> -r<R> [-t|-c] -q -p<P> -o] setup_code |
|
1041 | %%timeit [-n<N> -r<R> [-t|-c] -q -p<P> -o] setup_code | |
1035 | code |
|
1042 | ||
1036 |
code |
|
1043 | code | |
|
1044 | ||||
|
1045 | code... | |||
1037 |
|
1046 | |||
1038 | Time execution of a Python statement or expression using the timeit |
|
1047 | Time execution of a Python statement or expression using the timeit | |
1039 | module. This function can be used both as a line and cell magic: |
|
1048 | module. This function can be used both as a line and cell magic: | |
@@ -1046,6 +1055,7 b' class ExecutionMagics(Magics):' | |||||
1046 | body has access to any variables created in the setup code. |
|
1055 | body has access to any variables created in the setup code. | |
1047 |
|
1056 | |||
1048 | Options: |
|
1057 | Options: | |
|
1058 | ||||
1049 | -n<N>: execute the given statement <N> times in a loop. If <N> is not |
|
1059 | -n<N>: execute the given statement <N> times in a loop. If <N> is not | |
1050 | provided, <N> is determined so as to get sufficient accuracy. |
|
1060 | provided, <N> is determined so as to get sufficient accuracy. | |
1051 |
|
1061 | |||
@@ -1066,7 +1076,7 b' class ExecutionMagics(Magics):' | |||||
1066 | -q: Quiet, do not print result. |
|
1076 | -q: Quiet, do not print result. | |
1067 |
|
1077 | |||
1068 | -o: return a TimeitResult that can be stored in a variable to inspect |
|
1078 | -o: return a TimeitResult that can be stored in a variable to inspect | |
1069 |
|
|
1079 | the result in more details. | |
1070 |
|
1080 | |||
1071 | .. versionchanged:: 7.3 |
|
1081 | .. versionchanged:: 7.3 | |
1072 | User variables are no longer expanded, |
|
1082 | User variables are no longer expanded, |
General Comments 0
You need to be logged in to leave comments.
Login now