diff options
-rw-r--r-- | slides.html | 56 | ||||
-rw-r--r-- | slides.odp | bin | 10497 -> 10925 bytes | |||
-rw-r--r-- | slides.pdf | bin | 36680 -> 38440 bytes | |||
-rw-r--r-- | slides.rst | 64 |
4 files changed, 83 insertions, 37 deletions
diff --git a/slides.html b/slides.html index 950cc9c..68054f1 100644 --- a/slides.html +++ b/slides.html @@ -396,6 +396,8 @@ ul.auto-toc { <tbody valign="top"> <tr class="field"><th class="field-name">Author:</th><td class="field-body">Matěj Cepl <<a class="reference external" href="mailto:mcepl%40cepl.eu">mcepl<span>@</span>cepl<span>.</span>eu</a>></td> </tr> +<tr class="field"><th class="field-name">URL:</th><td class="field-body"><a class="reference external" href="https://matej.ceplovi.cz/clanky/PyCon18-m2crypto/slides.html">https://matej.ceplovi.cz/clanky/PyCon18-m2crypto/slides.html</a></td> +</tr> </tbody> </table> @@ -489,28 +491,11 @@ OpenSSL.</li> <h1>Strategy</h1> <ul class="simple"> <li>Type Hints</li> +<li>Documentation strings</li> <li>CI</li> <li>Extension of platform support</li> </ul> </div> -<div class="slide" id="type-hints"> -<h1>Type Hints</h1> -<ul> -<li><p class="first"><a class="reference external" href="https://www.python.org/dev/peps/pep-0484/">PEP 484</a> providing <strong>optional</strong> type annotations. Quite -controversial, but clearly very useful for libraries</p> -</li> -<li><p class="first">Native for Python >= 3.5, but supports py2k compatible syntax:</p> -<pre class="literal-block"> -def sum(x, y): - # type: (int, int) -> int - return x + y -</pre> -</li> -<li><p class="first">Especially useful for our situation: marking types helps us to -analyze what invidivual py2k <tt class="docutils literal">str</tt> actually mean.</p> -</li> -</ul> -</div> <div class="slide" id="c-api"> <h1>C API</h1> <ul class="simple"> @@ -541,6 +526,41 @@ py3k API</li> </li> </ul> </div> +<div class="slide" id="type-hints"> +<h1>Type Hints</h1> +<ul> +<li><p class="first"><a class="reference external" href="https://www.python.org/dev/peps/pep-0484/">PEP 484</a> providing <strong>optional</strong> type annotations. Quite +controversial, but clearly very useful for libraries</p> +</li> +<li><p class="first">Native for Python >= 3.5, but supports py2k compatible syntax:</p> +<pre class="literal-block"> +def sum(x, y): + # type: (int, int) -> int + return x + y +</pre> +</li> +<li><p class="first">Especially useful for our situation: marking types helps us to +analyze what invidivual py2k <tt class="docutils literal">str</tt> actually mean.</p> +</li> +</ul> +</div> +<div class="slide" id="python-porting-shims-again"> +<h1>Python porting (shims again)</h1> +<p>The same principles apply as with C functions, “shims, not +<tt class="docutils literal">#ifdef</tt> s”.</p> +<ul class="simple"> +<li>Plenty of issues are resolved by using <tt class="docutils literal">six</tt> (or +<tt class="docutils literal">modernize</tt>, <tt class="docutils literal">future</tt>), so use them. If I did it again, +I would probably use <tt class="docutils literal">future</tt> (and wrote py3k code), but the +difference is slim.</li> +<li>Do not hesitate to create your own shims. So I have for +example, <tt class="docutils literal">bix_to_hex</tt> and <tt class="docutils literal">oct_to_num</tt> or padding functions +there.</li> +<li><a class="reference external" href="http://python-future.org/compatible_idioms.html">http://python-future.org/compatible_idioms.html</a></li> +</ul> +<p class="handout">Whoever does not understand LISP, is doomed to reinvent it. +Badly. LISP -> six</p> +</div> </div> </body> </html> Binary files differBinary files differ@@ -5,6 +5,7 @@ Wounded hero revived Lessons learned from porting M2Crypto to Py3k :Author: Matěj Cepl <mcepl@cepl.eu> +:URL: https://matej.ceplovi.cz/clanky/PyCon18-m2crypto/slides.html Origins @@ -149,30 +150,13 @@ Strategy * Type Hints +* Documentation strings + * CI * Extension of platform support -Type Hints -========== - -* `PEP 484`_ providing **optional** type annotations. Quite - controversial, but clearly very useful for libraries - -* Native for Python >= 3.5, but supports py2k compatible syntax:: - - def sum(x, y): - # type: (int, int) -> int - return x + y - -* Especially useful for our situation: marking types helps us to - analyze what invidivual py2k ``str`` actually mean. - -.. _`PEP 484`: - https://www.python.org/dev/peps/pep-0484/ - - C API ===== @@ -205,3 +189,45 @@ C shims of missing functions - ``PyFile_AsFile()`` I have no idea, why it was removed from py3k API + + +Type Hints +========== + +* `PEP 484`_ providing **optional** type annotations. Quite + controversial, but clearly very useful for libraries + +* Native for Python >= 3.5, but supports py2k compatible syntax:: + + def sum(x, y): + # type: (int, int) -> int + return x + y + +* Especially useful for our situation: marking types helps us to + analyze what invidivual py2k ``str`` actually mean. + +.. _`PEP 484`: + https://www.python.org/dev/peps/pep-0484/ + + +Python porting (shims again) +============================ + +The same principles apply as with C functions, “shims, not +``#ifdef`` s”. + +* Plenty of issues are resolved by using ``six`` (or + ``modernize``, ``future``), so use them. If I did it again, + I would probably use ``future`` (and wrote py3k code), but the + difference is slim. + +* Do not hesitate to create your own shims. So I have for + example, ``bix_to_hex`` and ``oct_to_num`` or padding functions + there. + +* http://python-future.org/compatible_idioms.html + +.. class:: handout + + Whoever does not understand LISP, is doomed to reinvent it. + Badly. LISP -> six |