Show More
@@ -1035,7 +1035,7 b' Regular Options' | |||
|
1035 | 1035 | After the above threading options have been given, regular options can |
|
1036 | 1036 | follow in any order. All options can be abbreviated to their shortest |
|
1037 | 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 | 1040 | Most options can also be set from your ipythonrc configuration file. See |
|
1041 | 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 | 1373 | about magic commands you may have added as part of your personal |
|
1374 | 1374 | customizations. |
|
1375 | 1375 | |
|
1376 | :: | |
|
1376 | 1377 | |
|
1377 | 1378 | %Exit: Exit IPython without confirmation. |
|
1378 | 1379 | |
@@ -1712,8 +1713,8 b' Arguments:' | |||
|
1712 | 1713 | |
|
1713 | 1714 | If arguments are given, the following possibilites exist: |
|
1714 | 1715 | |
|
1715 |
- The arguments are numbers or pairs of |
|
|
1716 |
|
|
|
1716 | - The arguments are numbers or pairs of dash-separated numbers (like 1 | |
|
1717 | 4-8 9). These are interpreted as lines of previous input to be loaded | |
|
1717 | 1718 | into the editor. The syntax is the same of the %macro command. |
|
1718 | 1719 | |
|
1719 | 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 | 1736 | '+NUMBER' parameter necessary for this feature. Good editors like |
|
1736 | 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 | 1740 | file with that name (adding .py if necessary) and load it into the |
|
1740 | 1741 | editor. It will execute its contents with execfile() when you exit, |
|
1741 | 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 | 2201 | This version explicitly checks that every entry in $PATH is a file with |
|
2201 | 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 | 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 | 2208 | This function also resets the root module cache of module completer, |
|
2208 | 2209 | used on slow filesystems. |
@@ -2611,6 +2612,7 b' If called without arguments, acts as a toggle.' | |||
|
2611 | 2612 | |
|
2612 | 2613 | |
|
2613 | 2614 | Access to the standard Python help |
|
2615 | ---------------------------------- | |
|
2614 | 2616 | |
|
2615 | 2617 | As of Python 2.1, a help system is available with access to object |
|
2616 | 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 | 2626 | Dynamic object information |
|
2627 | -------------------------- | |
|
2625 | 2628 | |
|
2626 | 2629 | Typing ?word or word? prints detailed information about an object. If |
|
2627 | 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 | 2668 | Readline-based features |
|
2669 | ----------------------- | |
|
2666 | 2670 | |
|
2667 | 2671 | These features require the GNU readline library, so they won't work if |
|
2668 | 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 | 3122 | * [import_some <mod> <f1> <f2> ...:] import functions with 'from |
|
3119 | 3123 | <mod> import <f1>,<f2>,...' |
|
3120 | 3124 | * [import_all <mod1> <mod2> ...:] for each module listed import |
|
3121 |
functions with |
|
|
3125 | functions with ``from <mod> import *``. | |
|
3122 | 3126 | * [execute <python code>:] give any single-line python code to be |
|
3123 | 3127 | executed. |
|
3124 | 3128 | * [execfile <filename>:] execute the python file given with an |
@@ -3848,7 +3852,7 b' default prompts::' | |||
|
3848 | 3852 | prompt_in2 ' .\D.:' |
|
3849 | 3853 | prompt_out 'Out[\#]:' |
|
3850 | 3854 | |
|
3851 | which look like this: | |
|
3855 | which look like this:: | |
|
3852 | 3856 | |
|
3853 | 3857 | In [1]: 1+2 |
|
3854 | 3858 | Out[1]: 3 |
@@ -4304,6 +4308,7 b" Physics.PhysicalQuantities from Konrad Hinsen's ScientificPython" | |||
|
4304 | 4308 | The Physics.PhysicalQuantities module defines PhysicalQuantity objects, |
|
4305 | 4309 | but these must be declared as instances of a class. For example, to |
|
4306 | 4310 | define v as a velocity of 3 m/s, normally you would write:: |
|
4311 | ||
|
4307 | 4312 | In [1]: v = PhysicalQuantity(3,'m/s') |
|
4308 | 4313 | |
|
4309 | 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 | 4357 | recognized. !cmd is valid in single or multi-line input, all others are |
|
4353 | 4358 | only valid in single-line input:: |
|
4354 | 4359 | |
|
4355 |
|
|
|
4360 | !cmd | |
|
4356 | 4361 | pass 'cmd' directly to the shell |
|
4357 |
|
|
|
4362 | !!cmd* | |
|
4358 | 4363 | execute 'cmd' and return output as a list (split on '\n') |
|
4359 |
|
|
|
4364 | var=!cmd | |
|
4360 | 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 | 4367 | A few brief examples will illustrate these (note that the indentation |
|
4369 | 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 | 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 | 4474 | colored and detailed prompt, mainly to serve as an illustration. The |
|
4475 | 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 | 4595 | can be reset via sys.setcheckinterval(N). This switching of threads can |
|
4596 | 4596 | cause subtly confusing effects if one of your threads is doing file I/O. |
|
4597 | 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 | 4600 | print >> filehandle, ''hello world'' |
|
4601 | ||
|
4600 | 4602 | actually consists of several bytecodes, so it is possible that the |
|
4601 | 4603 | newline does not reach your file before the next thread switch. |
|
4602 | 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 | 4610 | written to from the IPython thread, the safest approach is to open all |
|
4609 | 4611 | of your files in unbuffered mode (the third argument to the file/open |
|
4610 | 4612 | function is the buffering value):: |
|
4613 | ||
|
4611 | 4614 | filehandle = open(filename,mode,0) |
|
4612 | 4615 | |
|
4613 | 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