| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent eebe879 commit 2b1d825
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,15 +3,14 @@ pythonnet | |||
| 3 | 3 | ||
| 4 | 4 | This fork of http://sourceforge.net/projects/pythonnet/ allows easy calling of python functions from C#. | |
| 5 | 5 | ||
| 6 | - All calls to python should be inside a "using (Py.GIL()) {/* Your code here */}" block. | ||
| 7 | - Import python modules using dynamic mod = Py.Import("mod"), then you can call functions as normal, eg | ||
| 8 | - mod.func(args). | ||
| 9 | - Use mod.func(args, Py.kw("keywordargname", keywordargvalue)) to apply keyword arguments. | ||
| 10 | - All python objects should be declared as 'dynamic' type. | ||
| 11 | - Mathematical operations involving python and literal/managed types must have the python object first, eg np.pi*2 works, 2*np.pi doesn't. | ||
| 6 | + + All calls to python should be inside a "using (Py.GIL()) {/* Your code here */}" block. | ||
| 7 | + + Import python modules using dynamic mod = Py.Import("mod"), then you can call functions as normal, eg mod.func(args). | ||
| 8 | + + Use mod.func(args, Py.kw("keywordargname", keywordargvalue)) to apply keyword arguments. | ||
| 9 | + + All python objects should be declared as 'dynamic' type. | ||
| 10 | + + Mathematical operations involving python and literal/managed types must have the python object first, eg np.pi*2 works, 2*np.pi doesn't | ||
| 12 | 11 | ||
| 13 | 12 | EG: | |
| 14 | - | ||
| 13 | + ```csharp | ||
| 15 | 14 | static void Main(string[] args) | |
| 16 | 15 | { | |
| 17 | 16 | using (Py.GIL()) { | |
@@ -28,12 +27,13 @@ static void Main(string[] args) | |||
| 28 | 27 | Console.ReadKey(); | |
| 29 | 28 | } | |
| 30 | 29 | } | |
| 31 | - | ||
| 32 | - which outputs: | ||
| 33 | - | ||
| 34 | - 1.0 | ||
| 30 | + ``` | ||
| 31 | + outputs: | ||
| 32 | + ``` | ||
| 33 | + 1.0 | ||
| 35 | 34 | -0.958924274663 | |
| 36 | 35 | -0.6752620892 | |
| 37 | 36 | float64 | |
| 38 | 37 | int32 | |
| 39 | 38 | [ 6. 10. 12.] | |
| 39 | + ``` | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments