- <div><div id=intro><p> The following shennanigans were collected during my work on creating a system integration library and framework for hardware and software tests including developer tasks like worktree management, building, target deployment and configuration. Therefore it should be representative for things one might want to do in absence of better tooling. The used Python version was 3.8.2, but most problems still persist.</p></div><div id=tldr><p> My <a href="#tldr"><strong>tldr;</strong></a> retrospection upfront, which you may be able to reproduce once you try to code long-running services, which recover from all failures, cleanly reset state or generally try to debug spurious problems. Please don’t.</p><p>Python on itself is great for prototyping up to a few hundred lines of code, like to quickly receive or send some json over tcp/html. <strong>However</strong>, it is unfeasible to scale, for example to use as library code. Changes in a leaf function can add exceptions to higher level code paths and handling those via exceptions for user friendly error messages, for example to collect context (information along multiple functions, for example from different combination of traversal) becomes unreasonably verbose and error prone. The alternative is to use C-like error handling, which requires to figure out all possible exceptions of Python libstd methods, which language servers do not support (as of 20240404).</p></div><div id=list_of_shennanigans><p> Aside of these more fundamental limitations, here the <a href="#list_of_shennanigans">list of shennanigans</a> I have run into:</p><ul><li><code>xml.dom.minidom</code> <a href="https://bugs.python.org/issue5752" target="_blank">breaks space and newlines</a>. Use <code>ElementTree</code>.</li><li><code>.strip()</code> is necessary after file read, because Python automatically adds <code>\n</code> and there is no way to read without newlines into a list.</li><li>Testing for subdictionaries with <code>dict</code> is unreadable, so such a method is missing <figure><pre><code class="python"><span class="keyword">def</span> <span class="function">is_subdict</span>(<span class="variable">small</span>: <span class="type">dict</span>, <span class="variable">big</span>: <span class="type">dict</span>) <span class="operator">-></span> <span class="type">bool</span>:
0 commit comments