Show More
@@ -454,9 +454,7 b' Currently the magic system has the following functions:\\n"""' | |||||
454 |
|
454 | |||
455 | 1 -> active, but do not apply if there are no arguments on the line. |
|
455 | 1 -> active, but do not apply if there are no arguments on the line. | |
456 |
|
456 | |||
457 | In this mode, you get: |
|
457 | In this mode, you get:: | |
458 |
|
||||
459 | .. sourcecode:: ipython |
|
|||
460 |
|
458 | |||
461 | In [1]: callable |
|
459 | In [1]: callable | |
462 | Out[1]: <built-in function callable> |
|
460 | Out[1]: <built-in function callable> | |
@@ -466,9 +464,7 b' Currently the magic system has the following functions:\\n"""' | |||||
466 | Out[2]: False |
|
464 | Out[2]: False | |
467 |
|
465 | |||
468 | 2 -> Active always. Even if no arguments are present, the callable |
|
466 | 2 -> Active always. Even if no arguments are present, the callable | |
469 | object is called: |
|
467 | object is called:: | |
470 |
|
||||
471 | .. sourcecode:: ipython |
|
|||
472 |
|
468 | |||
473 | In [2]: float |
|
469 | In [2]: float | |
474 | ------> float() |
|
470 | ------> float() | |
@@ -476,9 +472,7 b' Currently the magic system has the following functions:\\n"""' | |||||
476 |
|
472 | |||
477 | Note that even with autocall off, you can still use '/' at the start of |
|
473 | Note that even with autocall off, you can still use '/' at the start of | |
478 | a line to treat the first argument on the command line as a function |
|
474 | a line to treat the first argument on the command line as a function | |
479 | and add parentheses to it: |
|
475 | and add parentheses to it:: | |
480 |
|
||||
481 | .. sourcecode:: ipython |
|
|||
482 |
|
476 | |||
483 | In [8]: /str 43 |
|
477 | In [8]: /str 43 | |
484 | ------> str(43) |
|
478 | ------> str(43) | |
@@ -581,7 +575,7 b' Currently the magic system has the following functions:\\n"""' | |||||
581 |
|
575 | |||
582 | Examples |
|
576 | Examples | |
583 | -------- |
|
577 | -------- | |
584 | .. sourcecode:: ipython |
|
578 | :: | |
585 |
|
579 | |||
586 | In [3]: %pdef urllib.urlopen |
|
580 | In [3]: %pdef urllib.urlopen | |
587 | urllib.urlopen(url, data=None, proxies=None) |
|
581 | urllib.urlopen(url, data=None, proxies=None) | |
@@ -682,22 +676,24 b' Currently the magic system has the following functions:\\n"""' | |||||
682 | search with -s or exclude them with -e (these options can be given |
|
676 | search with -s or exclude them with -e (these options can be given | |
683 | more than once). |
|
677 | more than once). | |
684 |
|
678 | |||
685 |
Examples |
|
679 | Examples | |
|
680 | -------- | |||
|
681 | :: | |||
686 |
|
682 | |||
687 | %psearch a* -> objects beginning with an a |
|
683 | %psearch a* -> objects beginning with an a | |
688 | %psearch -e builtin a* -> objects NOT in the builtin space starting in a |
|
684 | %psearch -e builtin a* -> objects NOT in the builtin space starting in a | |
689 | %psearch a* function -> all functions beginning with an a |
|
685 | %psearch a* function -> all functions beginning with an a | |
690 | %psearch re.e* -> objects beginning with an e in module re |
|
686 | %psearch re.e* -> objects beginning with an e in module re | |
691 | %psearch r*.e* -> objects that start with e in modules starting in r |
|
687 | %psearch r*.e* -> objects that start with e in modules starting in r | |
692 | %psearch r*.* string -> all strings in modules beginning with r |
|
688 | %psearch r*.* string -> all strings in modules beginning with r | |
693 |
|
689 | |||
694 | Case sensitive search: |
|
690 | Case sensitive search:: | |
695 |
|
691 | |||
696 | %psearch -c a* list all object beginning with lower case a |
|
692 | %psearch -c a* list all object beginning with lower case a | |
697 |
|
693 | |||
698 | Show objects beginning with a single _: |
|
694 | Show objects beginning with a single _:: | |
699 |
|
695 | |||
700 | %psearch -a _* list objects beginning with a single underscore""" |
|
696 | %psearch -a _* list objects beginning with a single underscore""" | |
701 | try: |
|
697 | try: | |
702 | parameter_s.encode('ascii') |
|
698 | parameter_s.encode('ascii') | |
703 | except UnicodeEncodeError: |
|
699 | except UnicodeEncodeError: | |
@@ -743,9 +739,7 b' Currently the magic system has the following functions:\\n"""' | |||||
743 | Examples |
|
739 | Examples | |
744 | -------- |
|
740 | -------- | |
745 |
|
741 | |||
746 | Define two variables and list them with who_ls: |
|
742 | Define two variables and list them with who_ls:: | |
747 |
|
||||
748 | .. sourcecode:: ipython |
|
|||
749 |
|
743 | |||
750 | In [1]: alpha = 123 |
|
744 | In [1]: alpha = 123 | |
751 |
|
745 | |||
@@ -788,7 +782,7 b' Currently the magic system has the following functions:\\n"""' | |||||
788 | variables. To find the proper type names, simply use type(var) at a |
|
782 | variables. To find the proper type names, simply use type(var) at a | |
789 | command line to see how python prints type names. For example: |
|
783 | command line to see how python prints type names. For example: | |
790 |
|
784 | |||
791 | .. sourcecode:: ipython |
|
785 | :: | |
792 |
|
786 | |||
793 | In [1]: type('hello')\\ |
|
787 | In [1]: type('hello')\\ | |
794 | Out[1]: <type 'str'> |
|
788 | Out[1]: <type 'str'> | |
@@ -804,9 +798,7 b' Currently the magic system has the following functions:\\n"""' | |||||
804 | Examples |
|
798 | Examples | |
805 | -------- |
|
799 | -------- | |
806 |
|
800 | |||
807 | Define two variables and list them with who: |
|
801 | Define two variables and list them with who:: | |
808 |
|
||||
809 | .. sourcecode:: ipython |
|
|||
810 |
|
802 | |||
811 | In [1]: alpha = 123 |
|
803 | In [1]: alpha = 123 | |
812 |
|
804 | |||
@@ -859,9 +851,7 b' Currently the magic system has the following functions:\\n"""' | |||||
859 | Examples |
|
851 | Examples | |
860 | -------- |
|
852 | -------- | |
861 |
|
853 | |||
862 | Define two variables and list them with whos: |
|
854 | Define two variables and list them with whos:: | |
863 |
|
||||
864 | .. sourcecode:: ipython |
|
|||
865 |
|
855 | |||
866 | In [1]: alpha = 123 |
|
856 | In [1]: alpha = 123 | |
867 |
|
857 | |||
@@ -1002,8 +992,7 b' Currently the magic system has the following functions:\\n"""' | |||||
1002 |
|
992 | |||
1003 | Examples |
|
993 | Examples | |
1004 | -------- |
|
994 | -------- | |
1005 |
|
995 | :: | ||
1006 | .. sourcecode:: ipython |
|
|||
1007 |
|
996 | |||
1008 | In [6]: a = 1 |
|
997 | In [6]: a = 1 | |
1009 |
|
998 | |||
@@ -1119,16 +1108,12 b' Currently the magic system has the following functions:\\n"""' | |||||
1119 |
|
1108 | |||
1120 | We first fully reset the namespace so your output looks identical to |
|
1109 | We first fully reset the namespace so your output looks identical to | |
1121 | this example for pedagogical reasons; in practice you do not need a |
|
1110 | this example for pedagogical reasons; in practice you do not need a | |
1122 | full reset: |
|
1111 | full reset:: | |
1123 |
|
||||
1124 | .. sourcecode:: ipython |
|
|||
1125 |
|
1112 | |||
1126 | In [1]: %reset -f |
|
1113 | In [1]: %reset -f | |
1127 |
|
1114 | |||
1128 | Now, with a clean namespace we can make a few variables and use |
|
1115 | Now, with a clean namespace we can make a few variables and use | |
1129 | ``%reset_selective`` to only delete names that match our regexp: |
|
1116 | ``%reset_selective`` to only delete names that match our regexp:: | |
1130 |
|
||||
1131 | .. sourcecode:: ipython |
|
|||
1132 |
|
1117 | |||
1133 | In [2]: a=1; b=2; c=3; b1m=4; b2m=5; b3m=6; b4m=7; b2s=8 |
|
1118 | In [2]: a=1; b=2; c=3; b1m=4; b2m=5; b3m=6; b4m=7; b2s=8 | |
1134 |
|
1119 | |||
@@ -1234,14 +1219,14 b' Currently the magic system has the following functions:\\n"""' | |||||
1234 | Python code. |
|
1219 | Python code. | |
1235 |
|
1220 | |||
1236 | Since this marker is always the same, filtering only the output from |
|
1221 | Since this marker is always the same, filtering only the output from | |
1237 | a log is very easy, using for example a simple awk call: |
|
1222 | a log is very easy, using for example a simple awk call:: | |
1238 |
|
1223 | |||
1239 | awk -F'#\\[Out\\]# ' '{if($2) {print $2}}' ipython_log.py |
|
1224 | awk -F'#\\[Out\\]# ' '{if($2) {print $2}}' ipython_log.py | |
1240 |
|
1225 | |||
1241 | -r: log 'raw' input. Normally, IPython's logs contain the processed |
|
1226 | -r: log 'raw' input. Normally, IPython's logs contain the processed | |
1242 | input, so that user lines are logged in their final form, converted |
|
1227 | input, so that user lines are logged in their final form, converted | |
1243 | into valid Python. For example, %Exit is logged as |
|
1228 | into valid Python. For example, %Exit is logged as | |
1244 |
|
|
1229 | _ip.magic("Exit"). If the -r flag is given, all input is logged | |
1245 | exactly as typed, with no transformations applied. |
|
1230 | exactly as typed, with no transformations applied. | |
1246 |
|
1231 | |||
1247 | -t: put timestamps before each input line logged (these are put in |
|
1232 | -t: put timestamps before each input line logged (these are put in | |
@@ -1477,9 +1462,7 b' Currently the magic system has the following functions:\\n"""' | |||||
1477 | '%run -p [prof_opts] filename.py [args to program]' where prof_opts |
|
1462 | '%run -p [prof_opts] filename.py [args to program]' where prof_opts | |
1478 | contains profiler specific options as described here. |
|
1463 | contains profiler specific options as described here. | |
1479 |
|
1464 | |||
1480 | You can read the complete documentation for the profile module with: |
|
1465 | You can read the complete documentation for the profile module with:: | |
1481 |
|
||||
1482 | .. sourcecode:: ipython |
|
|||
1483 |
|
1466 | |||
1484 | In [1]: import profile; profile.help() |
|
1467 | In [1]: import profile; profile.help() | |
1485 | """ |
|
1468 | """ | |
@@ -1629,9 +1612,7 b' Currently the magic system has the following functions:\\n"""' | |||||
1629 | must be an integer indicating how many times you want the script to |
|
1612 | must be an integer indicating how many times you want the script to | |
1630 | run. The final timing report will include total and per run results. |
|
1613 | run. The final timing report will include total and per run results. | |
1631 |
|
1614 | |||
1632 | For example (testing the script uniq_stable.py): |
|
1615 | For example (testing the script uniq_stable.py):: | |
1633 |
|
||||
1634 | .. sourcecode:: ipython |
|
|||
1635 |
|
1616 | |||
1636 | In [1]: run -t uniq_stable |
|
1617 | In [1]: run -t uniq_stable | |
1637 |
|
1618 | |||
@@ -1655,7 +1636,7 b' Currently the magic system has the following functions:\\n"""' | |||||
1655 |
|
1636 | |||
1656 | with a breakpoint set on line 1 of your file. You can change the line |
|
1637 | with a breakpoint set on line 1 of your file. You can change the line | |
1657 | number for this automatic breakpoint to be <N> by using the -bN option |
|
1638 | number for this automatic breakpoint to be <N> by using the -bN option | |
1658 | (where N must be an integer). For example: |
|
1639 | (where N must be an integer). For example:: | |
1659 |
|
1640 | |||
1660 | %run -d -b40 myscript |
|
1641 | %run -d -b40 myscript | |
1661 |
|
1642 | |||
@@ -1692,7 +1673,7 b' Currently the magic system has the following functions:\\n"""' | |||||
1692 | the -m option for the python interpreter. Use this option last if you |
|
1673 | the -m option for the python interpreter. Use this option last if you | |
1693 | want to combine with other %run options. Unlike the python interpreter |
|
1674 | want to combine with other %run options. Unlike the python interpreter | |
1694 | only source modules are allowed no .pyc or .pyo files. |
|
1675 | only source modules are allowed no .pyc or .pyo files. | |
1695 | For example: |
|
1676 | For example:: | |
1696 |
|
1677 | |||
1697 | %run -m example |
|
1678 | %run -m example | |
1698 |
|
1679 | |||
@@ -1930,9 +1911,9 b' Currently the magic system has the following functions:\\n"""' | |||||
1930 | Default: 3 |
|
1911 | Default: 3 | |
1931 |
|
1912 | |||
1932 |
|
1913 | |||
1933 |
Examples |
|
1914 | Examples | |
1934 |
|
1915 | -------- | ||
1935 | .. sourcecode:: ipython |
|
1916 | :: | |
1936 |
|
1917 | |||
1937 | In [1]: %timeit pass |
|
1918 | In [1]: %timeit pass | |
1938 | 10000000 loops, best of 3: 53.3 ns per loop |
|
1919 | 10000000 loops, best of 3: 53.3 ns per loop | |
@@ -2056,7 +2037,7 b' Currently the magic system has the following functions:\\n"""' | |||||
2056 |
|
2037 | |||
2057 | Examples |
|
2038 | Examples | |
2058 | -------- |
|
2039 | -------- | |
2059 | .. sourcecode:: ipython |
|
2040 | :: | |
2060 |
|
2041 | |||
2061 | In [1]: time 2**128 |
|
2042 | In [1]: time 2**128 | |
2062 | CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s |
|
2043 | CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s | |
@@ -2174,9 +2155,7 b' Currently the magic system has the following functions:\\n"""' | |||||
2174 | 49: print 'x',x,'y',y |
|
2155 | 49: print 'x',x,'y',y | |
2175 |
|
2156 | |||
2176 | you can create a macro with lines 44 through 47 (included) and line 49 |
|
2157 | you can create a macro with lines 44 through 47 (included) and line 49 | |
2177 | called my_macro with: |
|
2158 | called my_macro with:: | |
2178 |
|
||||
2179 | .. sourcecode:: ipython |
|
|||
2180 |
|
2159 | |||
2181 | In [55]: %macro my_macro 44-47 49 |
|
2160 | In [55]: %macro my_macro 44-47 49 | |
2182 |
|
2161 | |||
@@ -2531,63 +2510,50 b' Currently the magic system has the following functions:\\n"""' | |||||
2531 | Note that %edit is also available through the alias %ed. |
|
2510 | Note that %edit is also available through the alias %ed. | |
2532 |
|
2511 | |||
2533 | This is an example of creating a simple function inside the editor and |
|
2512 | This is an example of creating a simple function inside the editor and | |
2534 | then modifying it. First, start up the editor: |
|
2513 | then modifying it. First, start up the editor:: | |
2535 |
|
||||
2536 | .. sourcecode :: ipython |
|
|||
2537 |
|
2514 | |||
2538 | In [1]: ed |
|
2515 | In [1]: ed | |
2539 | Editing... done. Executing edited code... |
|
2516 | Editing... done. Executing edited code... | |
2540 |
Out[1]: 'def foo():n print "foo() was defined in an editing |
|
2517 | Out[1]: 'def foo():\\n print "foo() was defined in an editing | |
2541 |
|
2518 | session"\\n' | ||
2542 | We can then call the function foo(): |
|
|||
2543 |
|
2519 | |||
2544 | .. sourcecode :: ipython |
|
2520 | We can then call the function foo():: | |
2545 |
|
2521 | |||
2546 | In [2]: foo() |
|
2522 | In [2]: foo() | |
2547 | foo() was defined in an editing session |
|
2523 | foo() was defined in an editing session | |
2548 |
|
2524 | |||
2549 | Now we edit foo. IPython automatically loads the editor with the |
|
2525 | Now we edit foo. IPython automatically loads the editor with the | |
2550 | (temporary) file where foo() was previously defined: |
|
2526 | (temporary) file where foo() was previously defined:: | |
2551 |
|
||||
2552 | .. sourcecode :: ipython |
|
|||
2553 |
|
2527 | |||
2554 | In [3]: ed foo |
|
2528 | In [3]: ed foo | |
2555 | Editing... done. Executing edited code... |
|
2529 | Editing... done. Executing edited code... | |
2556 |
|
2530 | |||
2557 | And if we call foo() again we get the modified version: |
|
2531 | And if we call foo() again we get the modified version:: | |
2558 |
|
||||
2559 | .. sourcecode :: ipython |
|
|||
2560 |
|
2532 | |||
2561 | In [4]: foo() |
|
2533 | In [4]: foo() | |
2562 | foo() has now been changed! |
|
2534 | foo() has now been changed! | |
2563 |
|
2535 | |||
2564 | Here is an example of how to edit a code snippet successive |
|
2536 | Here is an example of how to edit a code snippet successive | |
2565 | times. First we call the editor: |
|
2537 | times. First we call the editor:: | |
2566 |
|
||||
2567 | .. sourcecode :: ipython |
|
|||
2568 |
|
2538 | |||
2569 | In [5]: ed |
|
2539 | In [5]: ed | |
2570 | Editing... done. Executing edited code... |
|
2540 | Editing... done. Executing edited code... | |
2571 | hello |
|
2541 | hello | |
2572 | Out[5]: "print 'hello'n" |
|
2542 | Out[5]: "print 'hello'\\n" | |
2573 |
|
2543 | |||
2574 | Now we call it again with the previous output (stored in _): |
|
2544 | Now we call it again with the previous output (stored in _):: | |
2575 |
|
||||
2576 | .. sourcecode :: ipython |
|
|||
2577 |
|
2545 | |||
2578 | In [6]: ed _ |
|
2546 | In [6]: ed _ | |
2579 | Editing... done. Executing edited code... |
|
2547 | Editing... done. Executing edited code... | |
2580 | hello world |
|
2548 | hello world | |
2581 | Out[6]: "print 'hello world'n" |
|
2549 | Out[6]: "print 'hello world'\\n" | |
2582 |
|
||||
2583 | Now we call it with the output #8 (stored in _8, also as Out[8]): |
|
|||
2584 |
|
2550 | |||
2585 | .. sourcecode :: ipython |
|
2551 | Now we call it with the output #8 (stored in _8, also as Out[8]):: | |
2586 |
|
2552 | |||
2587 | In [7]: ed _8 |
|
2553 | In [7]: ed _8 | |
2588 | Editing... done. Executing edited code... |
|
2554 | Editing... done. Executing edited code... | |
2589 | hello again |
|
2555 | hello again | |
2590 | Out[7]: "print 'hello again'n" |
|
2556 | Out[7]: "print 'hello again'\\n" | |
2591 |
|
2557 | |||
2592 |
|
2558 | |||
2593 | Changing the default editor hook: |
|
2559 | Changing the default editor hook: | |
@@ -2758,18 +2724,14 b' Defaulting color scheme to \'NoColor\'"""' | |||||
2758 | alias can not be executed until 'del foo' removes the Python variable. |
|
2724 | alias can not be executed until 'del foo' removes the Python variable. | |
2759 |
|
2725 | |||
2760 | You can use the %l specifier in an alias definition to represent the |
|
2726 | You can use the %l specifier in an alias definition to represent the | |
2761 | whole line when the alias is called. For example: |
|
2727 | whole line when the alias is called. For example:: | |
2762 |
|
||||
2763 | .. sourcecode:: ipython |
|
|||
2764 |
|
2728 | |||
2765 | In [2]: alias bracket echo "Input in brackets: <%l>" |
|
2729 | In [2]: alias bracket echo "Input in brackets: <%l>" | |
2766 | In [3]: bracket hello world |
|
2730 | In [3]: bracket hello world | |
2767 | Input in brackets: <hello world> |
|
2731 | Input in brackets: <hello world> | |
2768 |
|
2732 | |||
2769 | You can also define aliases with parameters using %s specifiers (one |
|
2733 | You can also define aliases with parameters using %s specifiers (one | |
2770 | per parameter): |
|
2734 | per parameter):: | |
2771 |
|
||||
2772 | .. sourcecode:: ipython |
|
|||
2773 |
|
2735 | |||
2774 | In [1]: alias parts echo first %s second %s |
|
2736 | In [1]: alias parts echo first %s second %s | |
2775 | In [2]: %parts A B |
|
2737 | In [2]: %parts A B | |
@@ -2787,9 +2749,7 b' Defaulting color scheme to \'NoColor\'"""' | |||||
2787 | http://www.python.org/peps/pep-0215.html. This is the library used by |
|
2749 | http://www.python.org/peps/pep-0215.html. This is the library used by | |
2788 | IPython for variable expansion. If you want to access a true shell |
|
2750 | IPython for variable expansion. If you want to access a true shell | |
2789 | variable, an extra $ is necessary to prevent its expansion by |
|
2751 | variable, an extra $ is necessary to prevent its expansion by | |
2790 | IPython: |
|
2752 | IPython:: | |
2791 |
|
||||
2792 | .. sourcecode:: ipython |
|
|||
2793 |
|
2753 | |||
2794 | In [6]: alias show echo |
|
2754 | In [6]: alias show echo | |
2795 | In [7]: PATH='A Python string' |
|
2755 | In [7]: PATH='A Python string' | |
@@ -2918,7 +2878,7 b' Defaulting color scheme to \'NoColor\'"""' | |||||
2918 |
|
2878 | |||
2919 | Examples |
|
2879 | Examples | |
2920 | -------- |
|
2880 | -------- | |
2921 | .. sourcecode:: ipython |
|
2881 | :: | |
2922 |
|
2882 | |||
2923 | In [9]: pwd |
|
2883 | In [9]: pwd | |
2924 | Out[9]: '/home/tsuser/sprint/ipython' |
|
2884 | Out[9]: '/home/tsuser/sprint/ipython' | |
@@ -2960,7 +2920,7 b' Defaulting color scheme to \'NoColor\'"""' | |||||
2960 |
|
2920 | |||
2961 | Examples |
|
2921 | Examples | |
2962 | -------- |
|
2922 | -------- | |
2963 | .. sourcecode:: ipython |
|
2923 | :: | |
2964 |
|
2924 | |||
2965 | In [10]: cd parent/child |
|
2925 | In [10]: cd parent/child | |
2966 | /home/tsuser/parent/child |
|
2926 | /home/tsuser/parent/child | |
@@ -3174,9 +3134,7 b' Defaulting color scheme to \'NoColor\'"""' | |||||
3174 | space-separated string. These are convenient, respectively, either |
|
3134 | space-separated string. These are convenient, respectively, either | |
3175 | for sequential processing or to be passed to a shell command. |
|
3135 | for sequential processing or to be passed to a shell command. | |
3176 |
|
3136 | |||
3177 | For example: |
|
3137 | For example:: | |
3178 |
|
||||
3179 | .. sourcecode:: ipython |
|
|||
3180 |
|
3138 | |||
3181 | # Capture into variable a |
|
3139 | # Capture into variable a | |
3182 | In [1]: sc a=ls *py |
|
3140 | In [1]: sc a=ls *py | |
@@ -3208,9 +3166,7 b' Defaulting color scheme to \'NoColor\'"""' | |||||
3208 |
|
3166 | |||
3209 | Similarly, the lists returned by the -l option are also special, in |
|
3167 | Similarly, the lists returned by the -l option are also special, in | |
3210 | the sense that you can equally invoke the .s attribute on them to |
|
3168 | the sense that you can equally invoke the .s attribute on them to | |
3211 | automatically get a whitespace-separated string from their contents: |
|
3169 | automatically get a whitespace-separated string from their contents:: | |
3212 |
|
||||
3213 | .. sourcecode:: ipython |
|
|||
3214 |
|
3170 | |||
3215 | In [7]: sc -l b=ls *py |
|
3171 | In [7]: sc -l b=ls *py | |
3216 |
|
3172 | |||
@@ -3264,11 +3220,16 b' Defaulting color scheme to \'NoColor\'"""' | |||||
3264 | Notes: |
|
3220 | Notes: | |
3265 |
|
3221 | |||
3266 | 1) If an input line begins with '!!', then %sx is automatically |
|
3222 | 1) If an input line begins with '!!', then %sx is automatically | |
3267 | invoked. That is, while: |
|
3223 | invoked. That is, while:: | |
|
3224 | ||||
3268 | !ls |
|
3225 | !ls | |
3269 | causes ipython to simply issue system('ls'), typing |
|
3226 | ||
|
3227 | causes ipython to simply issue system('ls'), typing:: | |||
|
3228 | ||||
3270 | !!ls |
|
3229 | !!ls | |
3271 | is a shorthand equivalent to: |
|
3230 | ||
|
3231 | is a shorthand equivalent to:: | |||
|
3232 | ||||
3272 | %sx ls |
|
3233 | %sx ls | |
3273 |
|
3234 | |||
3274 | 2) %sx differs from %sc in that %sx automatically splits into a list, |
|
3235 | 2) %sx differs from %sc in that %sx automatically splits into a list, | |
@@ -3278,6 +3239,7 b' Defaulting color scheme to \'NoColor\'"""' | |||||
3278 | typing. |
|
3239 | typing. | |
3279 |
|
3240 | |||
3280 | 3) Just like %sc -l, this is a list with special attributes: |
|
3241 | 3) Just like %sc -l, this is a list with special attributes: | |
|
3242 | :: | |||
3281 |
|
3243 | |||
3282 | .l (or .list) : value as list. |
|
3244 | .l (or .list) : value as list. | |
3283 | .n (or .nlstr): value as newline-separated string. |
|
3245 | .n (or .nlstr): value as newline-separated string. | |
@@ -3299,8 +3261,10 b' Defaulting color scheme to \'NoColor\'"""' | |||||
3299 | %bookmark -d <name> - remove bookmark |
|
3261 | %bookmark -d <name> - remove bookmark | |
3300 | %bookmark -r - remove all bookmarks |
|
3262 | %bookmark -r - remove all bookmarks | |
3301 |
|
3263 | |||
3302 | You can later on access a bookmarked folder with: |
|
3264 | You can later on access a bookmarked folder with:: | |
|
3265 | ||||
3303 | %cd -b <name> |
|
3266 | %cd -b <name> | |
|
3267 | ||||
3304 | or simply '%cd <name>' if there is no directory called <name> AND |
|
3268 | or simply '%cd <name>' if there is no directory called <name> AND | |
3305 | there is such a bookmark defined. |
|
3269 | there is such a bookmark defined. | |
3306 |
|
3270 | |||
@@ -3548,9 +3512,7 b' Defaulting color scheme to \'NoColor\'"""' | |||||
3548 | pylab and mlab, as well as all names from numpy and pylab. |
|
3512 | pylab and mlab, as well as all names from numpy and pylab. | |
3549 |
|
3513 | |||
3550 | If you are using the inline matplotlib backend for embedded figures, |
|
3514 | If you are using the inline matplotlib backend for embedded figures, | |
3551 | you can adjust its behavior via the %config magic: |
|
3515 | you can adjust its behavior via the %config magic:: | |
3552 |
|
||||
3553 | .. sourcecode:: ipython |
|
|||
3554 |
|
3516 | |||
3555 | # enable SVG figures, necessary for SVG+XHTML export in the qtconsole |
|
3517 | # enable SVG figures, necessary for SVG+XHTML export in the qtconsole | |
3556 | In [1]: %config InlineBackend.figure_format = 'svg' |
|
3518 | In [1]: %config InlineBackend.figure_format = 'svg' | |
@@ -3570,9 +3532,7 b' Defaulting color scheme to \'NoColor\'"""' | |||||
3570 |
|
3532 | |||
3571 | Examples |
|
3533 | Examples | |
3572 | -------- |
|
3534 | -------- | |
3573 | In this case, where the MPL default is TkAgg: |
|
3535 | In this case, where the MPL default is TkAgg:: | |
3574 |
|
||||
3575 | .. sourcecode:: ipython |
|
|||
3576 |
|
3536 | |||
3577 | In [2]: %pylab |
|
3537 | In [2]: %pylab | |
3578 |
|
3538 | |||
@@ -3580,9 +3540,7 b' Defaulting color scheme to \'NoColor\'"""' | |||||
3580 | Backend in use: TkAgg |
|
3540 | Backend in use: TkAgg | |
3581 | For more information, type 'help(pylab)'. |
|
3541 | For more information, type 'help(pylab)'. | |
3582 |
|
3542 | |||
3583 | But you can explicitly request a different backend: |
|
3543 | But you can explicitly request a different backend:: | |
3584 |
|
||||
3585 | .. sourcecode:: ipython |
|
|||
3586 |
|
3544 | |||
3587 | In [3]: %pylab qt |
|
3545 | In [3]: %pylab qt | |
3588 |
|
3546 | |||
@@ -3621,7 +3579,7 b' Defaulting color scheme to \'NoColor\'"""' | |||||
3621 |
|
3579 | |||
3622 | Examples |
|
3580 | Examples | |
3623 | -------- |
|
3581 | -------- | |
3624 | .. sourcecode:: ipython |
|
3582 | :: | |
3625 |
|
3583 | |||
3626 | In [1]: from math import pi |
|
3584 | In [1]: from math import pi | |
3627 |
|
3585 | |||
@@ -3739,9 +3697,7 b' Defaulting color scheme to \'NoColor\'"""' | |||||
3739 | Examples |
|
3697 | Examples | |
3740 | -------- |
|
3698 | -------- | |
3741 |
|
3699 | |||
3742 | To see what classes are available for config, pass no arguments: |
|
3700 | To see what classes are available for config, pass no arguments:: | |
3743 |
|
||||
3744 | .. sourcecode:: ipython |
|
|||
3745 |
|
3701 | |||
3746 | In [1]: %config |
|
3702 | In [1]: %config | |
3747 | Available objects for config: |
|
3703 | Available objects for config: | |
@@ -3753,9 +3709,8 b' Defaulting color scheme to \'NoColor\'"""' | |||||
3753 | PromptManager |
|
3709 | PromptManager | |
3754 | DisplayFormatter |
|
3710 | DisplayFormatter | |
3755 |
|
3711 | |||
3756 |
To view what is configurable on a given class, just pass the class |
|
3712 | To view what is configurable on a given class, just pass the class | |
3757 |
|
3713 | name:: | ||
3758 | .. sourcecode:: ipython |
|
|||
3759 |
|
3714 | |||
3760 | In [2]: %config IPCompleter |
|
3715 | In [2]: %config IPCompleter | |
3761 | IPCompleter options |
|
3716 | IPCompleter options | |
@@ -3779,15 +3734,11 b' Defaulting color scheme to \'NoColor\'"""' | |||||
3779 | This will enable completion on elements of lists, results of function calls, |
|
3734 | This will enable completion on elements of lists, results of function calls, | |
3780 | etc., but can be unsafe because the code is actually evaluated on TAB. |
|
3735 | etc., but can be unsafe because the code is actually evaluated on TAB. | |
3781 |
|
3736 | |||
3782 | but the real use is in setting values: |
|
3737 | but the real use is in setting values:: | |
3783 |
|
||||
3784 | .. sourcecode:: ipython |
|
|||
3785 |
|
3738 | |||
3786 | In [3]: %config IPCompleter.greedy = True |
|
3739 | In [3]: %config IPCompleter.greedy = True | |
3787 |
|
3740 | |||
3788 | and these values are read from the user_ns if they are variables: |
|
3741 | and these values are read from the user_ns if they are variables:: | |
3789 |
|
||||
3790 | .. sourcecode:: ipython |
|
|||
3791 |
|
3742 | |||
3792 | In [4]: feeling_greedy=False |
|
3743 | In [4]: feeling_greedy=False | |
3793 |
|
3744 |
General Comments 0
You need to be logged in to leave comments.
Login now