|
56 | 56 |
|
57 | 57 | <body>
|
58 | 58 | <header>
|
59 |
| - <aside>June 2, 2025</aside> |
| 59 | + <aside>June 4, 2025</aside> |
60 | 60 | <a href="https://gto76.github.io" rel="author">Jure Šorn</a>
|
61 | 61 | </header>
|
62 | 62 |
|
@@ -2876,13 +2876,13 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment
|
2876 | 2876 | <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>
|
2877 | 2877 | <span class="hljs-keyword">import</span> pyximport; pyximport.install() <span class="hljs-comment"># Module that runs imported Cython scripts.</span>
|
2878 | 2878 | <span class="hljs-keyword">import</span> <cython_script> <span class="hljs-comment"># Script must be saved with '.pyx' extension.</span>
|
2879 |
| -<cython_script>.main() <span class="hljs-comment"># Main() isn't automatically executed.</span> |
2880 | 2879 | </code></pre></div></div>
|
2881 | 2880 |
|
2882 | 2881 |
|
2883 | 2882 |
|
2884 | 2883 | <div><h4 id="allcdefdefinitionsareoptionalbuttheycontributetothespeedup">All <code class="python hljs"><span class="hljs-string">'cdef'</span></code> definitions are optional, but they contribute to the speed-up:</h4><pre><code class="python language-python hljs"><span class="hljs-keyword">cdef</span> <ctype/type> [*]<var_name> [= <obj>]
|
2885 |
| -<span class="hljs-keyword">cdef</span> <ctype>[n_elements] <var_name> [= <coll_of_nums>] |
| 2884 | +<span class="hljs-keyword">cdef</span> <ctype>[n_items] <array_name> [= <coll_of_nums/structs>] |
| 2885 | +<span class="hljs-keyword">cdef</span> <ctype> *<array_name> = <<ctype> *> malloc(n_items * sizeof(<ctype>)) |
2886 | 2886 | <span class="hljs-keyword">cdef</span> <ctype/type/void> <func_name>(<ctype/type> [*]<arg_name>): ...
|
2887 | 2887 | </code></pre></div>
|
2888 | 2888 |
|
@@ -2939,7 +2939,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment
|
2939 | 2939 |
|
2940 | 2940 |
|
2941 | 2941 | <footer>
|
2942 |
| - <aside>June 2, 2025</aside> |
| 2942 | + <aside>June 4, 2025</aside> |
2943 | 2943 | <a href="https://gto76.github.io" rel="author">Jure Šorn</a>
|
2944 | 2944 | </footer>
|
2945 | 2945 |
|
|
0 commit comments