|
55 | 55 |
|
56 | 56 | <body> |
57 | 57 | <header> |
58 | | - <aside>December 9, 2024</aside> |
| 58 | + <aside>December 10, 2024</aside> |
59 | 59 | <a href="https://gto76.github.io" rel="author">Jure Šorn</a> |
60 | 60 | </header> |
61 | 61 |
|
@@ -2856,17 +2856,17 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment |
2856 | 2856 |
|
2857 | 2857 |
|
2858 | 2858 |
|
2859 | | -<div><h2 id="appendix"><a href="#appendix" name="appendix">#</a>Appendix</h2><div><h3 id="cython">Cython</h3><p><strong>Library that compiles Python code into C.</strong></p><pre><code class="python language-python hljs"><span class="hljs-comment"># $ pip3 install cython</span> |
2860 | | -<span class="hljs-keyword">import</span> pyximport; pyximport.install() |
2861 | | -<span class="hljs-keyword">import</span> <cython_script> |
2862 | | -<cython_script>.main() |
| 2859 | +<div><h2 id="appendix"><a href="#appendix" name="appendix">#</a>Appendix</h2><div><h3 id="cython">Cython</h3><p><strong>Library that compiles Python-like code into C.</strong></p><pre><code class="python language-python hljs"><span class="hljs-comment"># $ pip3 install cython</span> |
| 2860 | +<span class="hljs-keyword">import</span> pyximport; pyximport.install() <span class="hljs-comment"># Module that runs imported Cython scripts.</span> |
| 2861 | +<span class="hljs-keyword">import</span> <cython_script> <span class="hljs-comment"># Script needs a '.pyx' extension.</span> |
| 2862 | +<cython_script>.main() <span class="hljs-comment"># Main() isn't automatically executed.</span> |
2863 | 2863 | </code></pre></div></div> |
2864 | 2864 |
|
2865 | 2865 |
|
2866 | 2866 |
|
2867 | 2867 | <div><h4 id="definitions">Definitions:</h4><ul> |
2868 | 2868 | <li><strong>All <code class="python hljs"><span class="hljs-string">'cdef'</span></code> definitions are optional, but they contribute to the speed-up.</strong></li> |
2869 | | -<li><strong>Script needs to be saved with a <code class="python hljs"><span class="hljs-string">'pyx'</span></code> extension.</strong></li> |
| 2869 | +<li><strong>Also supports C pointers via <code class="python hljs"><span class="hljs-string">'*'</span></code> and <code class="python hljs"><span class="hljs-string">'&'</span></code>, structs, unions, and enums.</strong></li> |
2870 | 2870 | </ul><pre><code class="python language-python hljs"><span class="hljs-keyword">cdef</span> <ctype/type> <var_name> [= <obj>] |
2871 | 2871 | <span class="hljs-keyword">cdef</span> <ctype>[n_elements] <var_name> [= <coll_of_nums>] |
2872 | 2872 | <span class="hljs-keyword">cdef</span> <ctype/type/void> <func_name>(<ctype/type> <arg_name>): ... |
@@ -2924,7 +2924,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment |
2924 | 2924 |
|
2925 | 2925 |
|
2926 | 2926 | <footer> |
2927 | | - <aside>December 9, 2024</aside> |
| 2927 | + <aside>December 10, 2024</aside> |
2928 | 2928 | <a href="https://gto76.github.io" rel="author">Jure Šorn</a> |
2929 | 2929 | </footer> |
2930 | 2930 |
|
|
0 commit comments