Show More
@@ -1035,7 +1035,7 b' Regular Options' | |||||
1035 | After the above threading options have been given, regular options can |
|
1035 | After the above threading options have been given, regular options can | |
1036 | follow in any order. All options can be abbreviated to their shortest |
|
1036 | follow in any order. All options can be abbreviated to their shortest | |
1037 | non-ambiguous form and are case-sensitive. One or two dashes can be |
|
1037 | non-ambiguous form and are case-sensitive. One or two dashes can be | |
1038 | used. Some options have an alternate short form, indicated after a |. |
|
1038 | used. Some options have an alternate short form, indicated after a ``|``. | |
1039 |
|
1039 | |||
1040 | Most options can also be set from your ipythonrc configuration file. See |
|
1040 | Most options can also be set from your ipythonrc configuration file. See | |
1041 | the provided example for more details on what the options do. Options |
|
1041 | the provided example for more details on what the options do. Options | |
@@ -1373,6 +1373,7 b' typing %magic at the prompt, but that will also give you information' | |||||
1373 | about magic commands you may have added as part of your personal |
|
1373 | about magic commands you may have added as part of your personal | |
1374 | customizations. |
|
1374 | customizations. | |
1375 |
|
1375 | |||
|
1376 | :: | |||
1376 |
|
1377 | |||
1377 | %Exit: Exit IPython without confirmation. |
|
1378 | %Exit: Exit IPython without confirmation. | |
1378 |
|
1379 | |||
@@ -1712,8 +1713,8 b' Arguments:' | |||||
1712 |
|
1713 | |||
1713 | If arguments are given, the following possibilites exist: |
|
1714 | If arguments are given, the following possibilites exist: | |
1714 |
|
1715 | |||
1715 |
- The arguments are numbers or pairs of |
|
1716 | - The arguments are numbers or pairs of dash-separated numbers (like 1 | |
1716 |
|
|
1717 | 4-8 9). These are interpreted as lines of previous input to be loaded | |
1717 | into the editor. The syntax is the same of the %macro command. |
|
1718 | into the editor. The syntax is the same of the %macro command. | |
1718 |
|
1719 | |||
1719 | - If the argument doesn't start with a number, it is evaluated as a |
|
1720 | - If the argument doesn't start with a number, it is evaluated as a | |
@@ -1735,7 +1736,7 b' editors (like kedit and gedit up to Gnome 2.8) do not understand the' | |||||
1735 | '+NUMBER' parameter necessary for this feature. Good editors like |
|
1736 | '+NUMBER' parameter necessary for this feature. Good editors like | |
1736 | (X)Emacs, vi, jed, pico and joe all do. |
|
1737 | (X)Emacs, vi, jed, pico and joe all do. | |
1737 |
|
1738 | |||
1738 |
|
|
1739 | If the argument is not found as a variable, IPython will look for a | |
1739 | file with that name (adding .py if necessary) and load it into the |
|
1740 | file with that name (adding .py if necessary) and load it into the | |
1740 | editor. It will execute its contents with execfile() when you exit, |
|
1741 | editor. It will execute its contents with execfile() when you exit, | |
1741 | loading any code in the file into your interactive namespace. |
|
1742 | loading any code in the file into your interactive namespace. | |
@@ -2200,9 +2201,9 b' this system, only pure python code and magic commands.' | |||||
2200 | This version explicitly checks that every entry in $PATH is a file with |
|
2201 | This version explicitly checks that every entry in $PATH is a file with | |
2201 | execute access (os.X_OK), so it is much slower than %rehash. |
|
2202 | execute access (os.X_OK), so it is much slower than %rehash. | |
2202 |
|
2203 | |||
2203 |
Under Windows, it checks executability as a match agains a |
|
2204 | Under Windows, it checks executability as a match agains a ``|``-separated | |
2204 | string of extensions, stored in the IPython config variable |
|
2205 | string of extensions, stored in the IPython config variable | |
2205 |
win_exec_ext. This defaults to |
|
2206 | win_exec_ext. This defaults to ``exe|com|bat``. | |
2206 |
|
2207 | |||
2207 | This function also resets the root module cache of module completer, |
|
2208 | This function also resets the root module cache of module completer, | |
2208 | used on slow filesystems. |
|
2209 | used on slow filesystems. | |
@@ -2611,6 +2612,7 b' If called without arguments, acts as a toggle.' | |||||
2611 |
|
2612 | |||
2612 |
|
2613 | |||
2613 | Access to the standard Python help |
|
2614 | Access to the standard Python help | |
|
2615 | ---------------------------------- | |||
2614 |
|
2616 | |||
2615 | As of Python 2.1, a help system is available with access to object |
|
2617 | As of Python 2.1, a help system is available with access to object | |
2616 | docstrings and the Python manuals. Simply type 'help' (no quotes) to |
|
2618 | docstrings and the Python manuals. Simply type 'help' (no quotes) to | |
@@ -2622,6 +2624,7 b' your environment variable PYTHONDOCS for this feature to work correctly.' | |||||
2622 |
|
2624 | |||
2623 |
|
2625 | |||
2624 | Dynamic object information |
|
2626 | Dynamic object information | |
|
2627 | -------------------------- | |||
2625 |
|
2628 | |||
2626 | Typing ?word or word? prints detailed information about an object. If |
|
2629 | Typing ?word or word? prints detailed information about an object. If | |
2627 | certain strings in the object are too long (docstrings, code, etc.) they |
|
2630 | certain strings in the object are too long (docstrings, code, etc.) they | |
@@ -2663,6 +2666,7 b' are not really defined as separate identifiers. Try for example typing' | |||||
2663 |
|
2666 | |||
2664 |
|
2667 | |||
2665 | Readline-based features |
|
2668 | Readline-based features | |
|
2669 | ----------------------- | |||
2666 |
|
2670 | |||
2667 | These features require the GNU readline library, so they won't work if |
|
2671 | These features require the GNU readline library, so they won't work if | |
2668 | your Python installation lacks readline support. We will first describe |
|
2672 | your Python installation lacks readline support. We will first describe | |
@@ -3118,7 +3122,7 b' Each of these options may appear as many times as you need it in the file.' | |||||
3118 | * [import_some <mod> <f1> <f2> ...:] import functions with 'from |
|
3122 | * [import_some <mod> <f1> <f2> ...:] import functions with 'from | |
3119 | <mod> import <f1>,<f2>,...' |
|
3123 | <mod> import <f1>,<f2>,...' | |
3120 | * [import_all <mod1> <mod2> ...:] for each module listed import |
|
3124 | * [import_all <mod1> <mod2> ...:] for each module listed import | |
3121 |
functions with |
|
3125 | functions with ``from <mod> import *``. | |
3122 | * [execute <python code>:] give any single-line python code to be |
|
3126 | * [execute <python code>:] give any single-line python code to be | |
3123 | executed. |
|
3127 | executed. | |
3124 | * [execfile <filename>:] execute the python file given with an |
|
3128 | * [execfile <filename>:] execute the python file given with an | |
@@ -3848,7 +3852,7 b' default prompts::' | |||||
3848 | prompt_in2 ' .\D.:' |
|
3852 | prompt_in2 ' .\D.:' | |
3849 | prompt_out 'Out[\#]:' |
|
3853 | prompt_out 'Out[\#]:' | |
3850 |
|
3854 | |||
3851 | which look like this: |
|
3855 | which look like this:: | |
3852 |
|
3856 | |||
3853 | In [1]: 1+2 |
|
3857 | In [1]: 1+2 | |
3854 | Out[1]: 3 |
|
3858 | Out[1]: 3 | |
@@ -4304,6 +4308,7 b" Physics.PhysicalQuantities from Konrad Hinsen's ScientificPython" | |||||
4304 | The Physics.PhysicalQuantities module defines PhysicalQuantity objects, |
|
4308 | The Physics.PhysicalQuantities module defines PhysicalQuantity objects, | |
4305 | but these must be declared as instances of a class. For example, to |
|
4309 | but these must be declared as instances of a class. For example, to | |
4306 | define v as a velocity of 3 m/s, normally you would write:: |
|
4310 | define v as a velocity of 3 m/s, normally you would write:: | |
|
4311 | ||||
4307 | In [1]: v = PhysicalQuantity(3,'m/s') |
|
4312 | In [1]: v = PhysicalQuantity(3,'m/s') | |
4308 |
|
4313 | |||
4309 | Using the PhysicalQ_Input extension this can be input instead as: |
|
4314 | Using the PhysicalQ_Input extension this can be input instead as: | |
@@ -4352,19 +4357,13 b' commands instead of as Python code. The special escapes below are also' | |||||
4352 | recognized. !cmd is valid in single or multi-line input, all others are |
|
4357 | recognized. !cmd is valid in single or multi-line input, all others are | |
4353 | only valid in single-line input:: |
|
4358 | only valid in single-line input:: | |
4354 |
|
4359 | |||
4355 |
|
|
4360 | !cmd | |
4356 | pass 'cmd' directly to the shell |
|
4361 | pass 'cmd' directly to the shell | |
4357 |
|
|
4362 | !!cmd* | |
4358 | execute 'cmd' and return output as a list (split on '\n') |
|
4363 | execute 'cmd' and return output as a list (split on '\n') | |
4359 |
|
|
4364 | var=!cmd | |
4360 | capture output of cmd into var, as a string list |
|
4365 | capture output of cmd into var, as a string list | |
4361 |
|
4366 | |||
4362 | The $/$$ syntaxes make Python variables from system output, which you |
|
|||
4363 | can later use for further scripting. The converse is also possible: when |
|
|||
4364 | executing an alias or calling to the system via !/!!, you can expand any |
|
|||
4365 | python variable or expression by prepending it with $. Full details of |
|
|||
4366 | the allowed syntax can be found in Python's PEP 215. |
|
|||
4367 |
|
||||
4368 | A few brief examples will illustrate these (note that the indentation |
|
4367 | A few brief examples will illustrate these (note that the indentation | |
4369 | below may be incorrectly displayed):: |
|
4368 | below may be incorrectly displayed):: | |
4370 |
|
4369 | |||
@@ -4469,8 +4468,9 b" switching to any of them. Type 'cd?' for more details." | |||||
4469 |
|
4468 | |||
4470 |
|
4469 | |||
4471 | Prompt customization |
|
4470 | Prompt customization | |
|
4471 | -------------------- | |||
4472 |
|
4472 | |||
4473 |
The supplied ipy |
|
4473 | The supplied ipy_profile_sh.py profile comes with an example of a very | |
4474 | colored and detailed prompt, mainly to serve as an illustration. The |
|
4474 | colored and detailed prompt, mainly to serve as an illustration. The | |
4475 | valid escape sequences, besides color names, are: |
|
4475 | valid escape sequences, besides color names, are: | |
4476 |
|
4476 | |||
@@ -4595,8 +4595,10 b' value can be read by using the sys.getcheckinterval() function, and it' | |||||
4595 | can be reset via sys.setcheckinterval(N). This switching of threads can |
|
4595 | can be reset via sys.setcheckinterval(N). This switching of threads can | |
4596 | cause subtly confusing effects if one of your threads is doing file I/O. |
|
4596 | cause subtly confusing effects if one of your threads is doing file I/O. | |
4597 | In text mode, most systems only flush file buffers when they encounter a |
|
4597 | In text mode, most systems only flush file buffers when they encounter a | |
4598 | '\n'. An instruction as simple as |
|
4598 | '\n'. An instruction as simple as:: | |
|
4599 | ||||
4599 | print >> filehandle, ''hello world'' |
|
4600 | print >> filehandle, ''hello world'' | |
|
4601 | ||||
4600 | actually consists of several bytecodes, so it is possible that the |
|
4602 | actually consists of several bytecodes, so it is possible that the | |
4601 | newline does not reach your file before the next thread switch. |
|
4603 | newline does not reach your file before the next thread switch. | |
4602 | Similarly, if you are writing to a file in binary mode, the file won't |
|
4604 | Similarly, if you are writing to a file in binary mode, the file won't | |
@@ -4608,6 +4610,7 b' example) a GUI application which will read data generated by files' | |||||
4608 | written to from the IPython thread, the safest approach is to open all |
|
4610 | written to from the IPython thread, the safest approach is to open all | |
4609 | of your files in unbuffered mode (the third argument to the file/open |
|
4611 | of your files in unbuffered mode (the third argument to the file/open | |
4610 | function is the buffering value):: |
|
4612 | function is the buffering value):: | |
|
4613 | ||||
4611 | filehandle = open(filename,mode,0) |
|
4614 | filehandle = open(filename,mode,0) | |
4612 |
|
4615 | |||
4613 | This is obviously a brute force way of avoiding race conditions with the |
|
4616 | This is obviously a brute force way of avoiding race conditions with the |
General Comments 0
You need to be logged in to leave comments.
Login now