<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>rixx.de (Posts about studying)</title><link>https://rixx.de/</link><description></description><atom:link href="https://rixx.de/categories/c-studying.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><lastBuildDate>Wed, 19 Feb 2025 15:35:18 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>December 13: Python Concurrent Execution Modules</title><link>https://rixx.de/blog/december-13-python-concurrent-execution-modules/</link><dc:creator>rixx</dc:creator><description>&lt;div&gt;&lt;p&gt;Now we get to talk about a completely trivial topic, barely worth mentioning: Concurrent execution, including
&lt;code&gt;threading&lt;/code&gt;, &lt;code&gt;multiprocessing&lt;/code&gt;, &lt;code&gt;concurrent&lt;/code&gt;, &lt;code&gt;subprocess&lt;/code&gt;, &lt;code&gt;sched&lt;/code&gt; and &lt;code&gt;queue&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Now, you might say, "wait a second, it is not December 13th!", and … you would be right. Life got in the way and I had
to spend a week figuring some things out, and pushing out a blog post about concurrency in Python did not quite fit in
with that. Now all the things are figured out, and I'm continuing the &lt;a href="https://rixx.de/blog/0-introduction"&gt;Traversal of the Python Standard Library
Documentation&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id="highlights"&gt;Highlights&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Oh god Popen has so many arguments.&lt;/li&gt;
&lt;li&gt;Python ships a "general purpose event scheduler"&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="https://rixx.de/blog/december-13-python-concurrent-execution-modules/"&gt;Read more…&lt;/a&gt; (8 min remaining to read)&lt;/p&gt;&lt;/div&gt;</description><guid>https://rixx.de/blog/december-13-python-concurrent-execution-modules/</guid><pubDate>Sat, 19 Dec 2020 07:00:00 GMT</pubDate></item><item><title>December 12: Context Variables</title><link>https://rixx.de/blog/december-12-context-variables/</link><dc:creator>rixx</dc:creator><description>&lt;div&gt;&lt;p&gt;As part of the &lt;a href="https://rixx.de/blog/0-introduction"&gt;Python Standard Library documentation traversal&lt;/a&gt;, we're following up on
yesterday's exhausting post about &lt;a href="https://rixx.de/blog/december-11-python-operating-system-services/"&gt;Operating System Services&lt;/a&gt; with
probably the shortest chapter yet: the &lt;code&gt;contextvars&lt;/code&gt; module. It's not cheating, it really is listed as its own
high-level documentation section!&lt;/p&gt;
&lt;p&gt;&lt;a href="https://rixx.de/blog/december-12-context-variables/"&gt;Read more…&lt;/a&gt; (2 min remaining to read)&lt;/p&gt;&lt;/div&gt;</description><guid>https://rixx.de/blog/december-12-context-variables/</guid><pubDate>Sat, 12 Dec 2020 07:00:00 GMT</pubDate></item><item><title>December 11: Python Operating System Services</title><link>https://rixx.de/blog/december-11-python-operating-system-services/</link><dc:creator>rixx</dc:creator><description>&lt;div&gt;&lt;p&gt;After some restful days, today's &lt;a href="https://rixx.de/blog/0-introduction"&gt;Python Standard Library Traversal&lt;/a&gt; follows up yesterday's
&lt;a href="https://rixx.de/blog/december-10-python-cryptographic-service-modules/"&gt;Cryptographic Service Modules&lt;/a&gt; with all the generic OS
interaction modules. That is &lt;code&gt;os&lt;/code&gt; (but not &lt;code&gt;os.path&lt;/code&gt;, we did that &lt;a href="https://rixx.de/blog/december-6-python-file-and-directory-access/"&gt;a week
ago&lt;/a&gt;), &lt;code&gt;io&lt;/code&gt;, &lt;code&gt;time&lt;/code&gt;, &lt;code&gt;argparse&lt;/code&gt;, &lt;code&gt;getopt&lt;/code&gt;, &lt;code&gt;logging&lt;/code&gt; and its
submodules, &lt;code&gt;getpass&lt;/code&gt;, &lt;code&gt;curses&lt;/code&gt; and submodules, &lt;code&gt;platform&lt;/code&gt;, &lt;code&gt;errno&lt;/code&gt; and &lt;code&gt;ctypes&lt;/code&gt;. Strap in!&lt;/p&gt;
&lt;h3 id="highlights"&gt;Highlights&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;On Windows, &lt;code&gt;os.startfile()&lt;/code&gt; acts like double-clicking the file.&lt;/li&gt;
&lt;li&gt;There are way too many ways to start new processes in Python.&lt;/li&gt;
&lt;li&gt;"&lt;em&gt;seconds since epoch&lt;/em&gt;" usually excludes leap seconds.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;argparse&lt;/code&gt; is honestly not as bad as I remembered it. Stockholm syndrome?&lt;/li&gt;
&lt;li&gt;&lt;code&gt;logger.getChild()&lt;/code&gt; is like calling &lt;code&gt;getLogger()&lt;/code&gt; on the full target name, very useful when you use stand-in values
  like &lt;code&gt;__name__&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;logger.handlers.TimedRotatingFileHandler&lt;/code&gt; and &lt;code&gt;logger.handlers.RotatingFileHandler&lt;/code&gt; handle log file rotation, nice!&lt;/li&gt;
&lt;li&gt;&lt;code&gt;logger.handlers.HTTPHandler&lt;/code&gt; defaults to &lt;code&gt;secure=False&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;You can change the default &lt;code&gt;%&lt;/code&gt;-style string formatting in logging formatters to &lt;code&gt;str.format()&lt;/code&gt; or &lt;code&gt;string.Template&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;You can query the platform you are running on with the &lt;code&gt;platform&lt;/code&gt; module.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="https://rixx.de/blog/december-11-python-operating-system-services/"&gt;Read more…&lt;/a&gt; (12 min remaining to read)&lt;/p&gt;&lt;/div&gt;</description><guid>https://rixx.de/blog/december-11-python-operating-system-services/</guid><pubDate>Fri, 11 Dec 2020 07:00:00 GMT</pubDate></item><item><title>December 10: Python Cryptographic Service Modules</title><link>https://rixx.de/blog/december-10-python-cryptographic-service-modules/</link><dc:creator>rixx</dc:creator><description>&lt;div&gt;&lt;p&gt;Shhh! 🤫 As part of the &lt;a href="https://rixx.de/blog/0-introduction/"&gt;Python Standard Library traversal&lt;/a&gt;, after &lt;a href="https://rixx.de/blog/december-9-python-file-format-modules/"&gt;yesterday's
look at file format modules&lt;/a&gt;, today is going to be all about secrets.
Well, all about &lt;code&gt;secrets&lt;/code&gt; and &lt;code&gt;hmac&lt;/code&gt; and &lt;code&gt;hashlib&lt;/code&gt;, to be precise.&lt;/p&gt;
&lt;h3 id="highlights"&gt;Highlights&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;There's an awful lot of hash algorithms in &lt;code&gt;hashlib&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;secrets&lt;/code&gt; module exists and is suitable for (reasonably) strong randomness, eg for generating long secret URLs.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="https://rixx.de/blog/december-10-python-cryptographic-service-modules/"&gt;Read more…&lt;/a&gt; (1 min remaining to read)&lt;/p&gt;&lt;/div&gt;</description><guid>https://rixx.de/blog/december-10-python-cryptographic-service-modules/</guid><pubDate>Thu, 10 Dec 2020 07:00:00 GMT</pubDate></item><item><title>December 9: Python File Format Modules</title><link>https://rixx.de/blog/december-9-python-file-format-modules/</link><dc:creator>rixx</dc:creator><description>&lt;div&gt;&lt;p&gt;Combining the commonplace and the weirdly specific: As part of the &lt;a href="https://rixx.de/blog/first-sunday-of-advent-built-in-functions/"&gt;Python Standard Library
traversal&lt;/a&gt;, after &lt;a href="https://rixx.de/blog/december-8-python-data-compression-and-archiving-modules"&gt;yesterday's short post about data
compression and archiving modules&lt;/a&gt;, today we're going to
look at Python file format modules. Those include &lt;code&gt;csv&lt;/code&gt;, &lt;code&gt;configparser&lt;/code&gt;, &lt;code&gt;netrc&lt;/code&gt;, &lt;code&gt;xdrlib&lt;/code&gt; and the forgettable
&lt;code&gt;plistlib&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id="highlights"&gt;Highlights&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Writing your own &lt;code&gt;csv&lt;/code&gt; dialect is extremely easy. I wonder how cursed you can make it.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;configparser&lt;/code&gt; has an extended interpolation mode that allows you to refer to values from other sections like
  &lt;code&gt;%{OtherSection:other_value}&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;You can configure lots of things about &lt;code&gt;configparser&lt;/code&gt;, like the delimiters, comment prefix, strict mode, enable
  multiline strings with empty lines, permit empty/flag values, …&lt;/li&gt;
&lt;li&gt;Why on earth is &lt;code&gt;csv&lt;/code&gt; in a different documentation block from &lt;code&gt;json&lt;/code&gt; and &lt;code&gt;xml&lt;/code&gt;?&lt;/li&gt;
&lt;li&gt;I learnt that the &lt;code&gt;netrc&lt;/code&gt; FTP configuration format exists, and requires its own stdlib support module.&lt;/li&gt;
&lt;li&gt;I learnt that &lt;code&gt;xdr&lt;/code&gt; file format exists, and at least the Python interface sounds pretty annoying.&lt;/li&gt;
&lt;li&gt;I learnt that &lt;code&gt;plist&lt;/code&gt; Apple format exists, and it sounds not that bad.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="https://rixx.de/blog/december-9-python-file-format-modules/"&gt;Read more…&lt;/a&gt; (3 min remaining to read)&lt;/p&gt;&lt;/div&gt;</description><guid>https://rixx.de/blog/december-9-python-file-format-modules/</guid><pubDate>Wed, 09 Dec 2020 07:00:00 GMT</pubDate></item><item><title>December 8: Pyton Data Compression and Archiving Modules</title><link>https://rixx.de/blog/december-8-pyton-data-compression-and-archiving-modules/</link><dc:creator>rixx</dc:creator><description>&lt;div&gt;&lt;p&gt;As part of the &lt;a href="https://rixx.de/blog/first-sunday-of-advent-built-in-functions/"&gt;Python Standard Library
traversal&lt;/a&gt;, after &lt;a href="https://rixx.de/blog/december-7-python-data-persistence-modules/"&gt;yesterday's short post about data
persistence&lt;/a&gt;, today we're going to look at Python data compression
modules. There are not too many of them, but definitely more than I knew: &lt;code&gt;zlib&lt;/code&gt;, &lt;code&gt;gzip&lt;/code&gt;, &lt;code&gt;bz2&lt;/code&gt;, &lt;code&gt;lzma&lt;/code&gt;, &lt;code&gt;zipfile&lt;/code&gt;,
&lt;code&gt;tarfile&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id="highlights"&gt;Highlights&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Now I know that Python supports six different main compression protocols out of the box.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;zipfile&lt;/code&gt; module has a CLI interface for compression, extraction and listing of archives.&lt;/li&gt;
&lt;li&gt;Same for &lt;code&gt;tarfile&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;When opening a tarfile, you can pass the intended compression algorithm with the file mode, like &lt;code&gt;w:bz2&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="https://rixx.de/blog/december-8-pyton-data-compression-and-archiving-modules/"&gt;Read more…&lt;/a&gt; (2 min remaining to read)&lt;/p&gt;&lt;/div&gt;</description><guid>https://rixx.de/blog/december-8-pyton-data-compression-and-archiving-modules/</guid><pubDate>Tue, 08 Dec 2020 07:00:00 GMT</pubDate></item><item><title>December 7: Python Data Persistence Modules</title><link>https://rixx.de/blog/december-7-python-data-persistence-modules/</link><dc:creator>rixx</dc:creator><description>&lt;div&gt;&lt;p&gt;Strap in, this is a long one: As part of the &lt;a href="https://rixx.de/blog/first-sunday-of-advent-built-in-functions/"&gt;Python Standard Library
traversal&lt;/a&gt;, after &lt;a href="https://rixx.de/blog/december-2-python-binary-data-services"&gt;yesterday's short post about binary
data services&lt;/a&gt;, today we're going to look at Python data type modules.
There's a lot of them: &lt;code&gt;datetime&lt;/code&gt;, &lt;code&gt;calendar&lt;/code&gt;, &lt;code&gt;collections&lt;/code&gt;, &lt;code&gt;heapq&lt;/code&gt;, &lt;code&gt;bisect&lt;/code&gt;, &lt;code&gt;array&lt;/code&gt;, &lt;code&gt;weakref&lt;/code&gt;, &lt;code&gt;types&lt;/code&gt;, &lt;code&gt;copy&lt;/code&gt;,
&lt;code&gt;pprint&lt;/code&gt;, &lt;code&gt;reprlib&lt;/code&gt; and &lt;code&gt;enum&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id="highlights"&gt;Highlights&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;You can use &lt;code&gt;shelve&lt;/code&gt; to store pickled objects in a persistent key-value store.&lt;/li&gt;
&lt;li&gt;The Unix &lt;code&gt;dbm&lt;/code&gt; library is a thing that exists and has Python standard library support.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="https://rixx.de/blog/december-7-python-data-persistence-modules/"&gt;Read more…&lt;/a&gt; (4 min remaining to read)&lt;/p&gt;&lt;/div&gt;</description><guid>https://rixx.de/blog/december-7-python-data-persistence-modules/</guid><pubDate>Mon, 07 Dec 2020 07:00:00 GMT</pubDate></item><item><title>December 6: Python File and Directory Access</title><link>https://rixx.de/blog/december-6-python-file-and-directory-access/</link><dc:creator>rixx</dc:creator><description>&lt;div&gt;&lt;p&gt;There's no place where "one obvious way to do things" fails as much as it does with file and OS interaction. As part of
the &lt;a href="https://rixx.de/blog/first-sunday-of-advent-built-in-functions/"&gt;Python Standard Library traversal&lt;/a&gt;, after
&lt;a href="https://rixx.de/blog/december-5-python-functional-programming-modules/"&gt;yesterday's post about functional programming modules&lt;/a&gt;, today
we're going to look at the file and directory access modules. Yes, all of them: &lt;code&gt;pathlib&lt;/code&gt;, &lt;code&gt;os.path&lt;/code&gt;, &lt;code&gt;fileinput&lt;/code&gt;,
&lt;code&gt;stat&lt;/code&gt;, &lt;code&gt;filecmp&lt;/code&gt;, &lt;code&gt;tempfile&lt;/code&gt;, &lt;code&gt;glob&lt;/code&gt;, &lt;code&gt;fnmatch&lt;/code&gt;, &lt;code&gt;linecache&lt;/code&gt; and &lt;code&gt;shutil&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id="highlights"&gt;Highlights&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;The 80% overlap between &lt;code&gt;pathlib&lt;/code&gt; and &lt;code&gt;os.path&lt;/code&gt; is bordering on hilarious. One obvious way indeed.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;fileinput&lt;/code&gt; is really weird.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;stat&lt;/code&gt; allows you to query and extract results of &lt;code&gt;os.stat()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;shutil.diskusage()&lt;/code&gt; returns total, used and free bytes for a given directory.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;shutil.which()&lt;/code&gt; looks up executables (platform independent &lt;code&gt;which&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;shutil.make_archive&lt;/code&gt; supports zip, tar, gztar, bztar and xtar out of the box.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="https://rixx.de/blog/december-6-python-file-and-directory-access/"&gt;Read more…&lt;/a&gt; (6 min remaining to read)&lt;/p&gt;&lt;/div&gt;</description><guid>https://rixx.de/blog/december-6-python-file-and-directory-access/</guid><pubDate>Sun, 06 Dec 2020 07:00:00 GMT</pubDate></item><item><title>December 5: Python Functional Programming Modules</title><link>https://rixx.de/blog/december-5-python-functional-programming-modules/</link><dc:creator>rixx</dc:creator><description>&lt;div&gt;&lt;p&gt;A short entry for a change: As part of the &lt;a href="https://rixx.de/blog/first-sunday-of-advent-built-in-functions/"&gt;Python Standard Library
traversal&lt;/a&gt;, after &lt;a href="https://rixx.de/blog/december-4-python-numeric-and-mathematical-modules/"&gt;yesterday's short post about
Python's numeric and mathematical modules&lt;/a&gt;, I'm taking a look
at &lt;code&gt;itertools&lt;/code&gt;, &lt;code&gt;functools&lt;/code&gt; and &lt;code&gt;operator&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id="highlights"&gt;Highlights&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;There really are a lot of &lt;code&gt;itertools&lt;/code&gt; functions.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;functools&lt;/code&gt; contains a &lt;code&gt;cached_property&lt;/code&gt; decorator.&lt;/li&gt;
&lt;li&gt;I finally know what &lt;code&gt;lru_cache&lt;/code&gt; does.&lt;/li&gt;
&lt;li&gt;Apparently Python has a type of function overloading, by type of first argument, with &lt;code&gt;singledispatch&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;There are &lt;code&gt;operator&lt;/code&gt; functions for performing in-place operations like &lt;code&gt;+=&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;operator.attrgetter&lt;/code&gt; can retrieve multiple and nested attributes.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;operator.itemgetter&lt;/code&gt; can retrieve multiple items.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="https://rixx.de/blog/december-5-python-functional-programming-modules/"&gt;Read more…&lt;/a&gt; (3 min remaining to read)&lt;/p&gt;&lt;/div&gt;</description><guid>https://rixx.de/blog/december-5-python-functional-programming-modules/</guid><pubDate>Sat, 05 Dec 2020 11:00:00 GMT</pubDate></item><item><title>December 4: Python Numeric and Mathematical Modules</title><link>https://rixx.de/blog/december-4-python-numeric-and-mathematical-modules/</link><dc:creator>rixx</dc:creator><description>&lt;div&gt;&lt;p&gt;Today is a bit less bad than yesterday: As part of the &lt;a href="https://rixx.de/blog/first-sunday-of-advent-built-in-functions/"&gt;Python Standard Library
traversal&lt;/a&gt;, after &lt;a href="https://rixx.de/blog/december-3-python-data-types"&gt;yesterday's extensive post about
data types&lt;/a&gt;, today we're going to look at Python modules that take care of numbers
and maths and make us very happy because we don't need to implement them ourselves. Or wait for NumPy to install.&lt;/p&gt;
&lt;h3 id="highlights"&gt;Highlights&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;numbers&lt;/code&gt; module contains abstract base classes so you can check for features of given numbers using &lt;code&gt;isinstance&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The Python documentation takes a stand for &lt;code&gt;tau&lt;/code&gt; and against &lt;code&gt;pi&lt;/code&gt;. Good documentation.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cmath&lt;/code&gt; provides mathematical operations and functions for complex numbers – it exists separately from &lt;code&gt;math&lt;/code&gt; so that
  people aren't surprised when they run &lt;code&gt;math.sqrt(-1)&lt;/code&gt;. 🤣&lt;/li&gt;
&lt;li&gt;&lt;code&gt;fractions.limit_denominator()&lt;/code&gt; allows you to take a float and turn it into the number it was meant to be. Go team
  &lt;code&gt;fractions&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The fact that &lt;code&gt;decimal&lt;/code&gt; is singular and &lt;code&gt;fractions&lt;/code&gt; is plural will never cease to confuse me.&lt;/li&gt;
&lt;li&gt;Apparently there's both &lt;code&gt;random.gauss()&lt;/code&gt; and &lt;code&gt;random.normalvariate()&lt;/code&gt; ???&lt;/li&gt;
&lt;li&gt;&lt;code&gt;statistics.NormalDist&lt;/code&gt; creates a normal distribution either from a set of samples or the mean and a standard
  deviation.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="https://rixx.de/blog/december-4-python-numeric-and-mathematical-modules/"&gt;Read more…&lt;/a&gt; (4 min remaining to read)&lt;/p&gt;&lt;/div&gt;</description><guid>https://rixx.de/blog/december-4-python-numeric-and-mathematical-modules/</guid><pubDate>Fri, 04 Dec 2020 07:00:00 GMT</pubDate></item></channel></rss>