Roland's homepage

My random knot in the Web

Articles tagged with "python3"

  1. Doing calculations with Python

    As an engineer I do a lot of calculations. These can be done with pen and paper and a calculator, in an IPython notebook or in a throwaway spreadsheet. All of these methods have shortcomings, though.

    Pen and paper is hard to share and (in my case) hard for others to read. In IPython you can assign the results of calculations to a variable, but you have to perform a separate action to display them. And spreadsheets in general show you the results but not the calculations.

    So I wrote a simple function in Python to help me with that. Using this function I can print both simple assignments and relatively complex calculations. And it shows both the calculation and the result.

  2. Structures in Python

    Sometimes I miss the C’s plain old struct in Python.

    Of course Python has dictionaries, but I prefer to write a.b over a['b'].

    Here are three ways of doing something akin to a struct in Python.

  3. Using gnuplot from Python

    According to my revision control systems (rcs in those days), I’ve been using gnuplot to make graphs since at least 2002. And I’ve got it set up via a custom gnuplotrc to match the style of the TeX documents I often use the graphs in.

    At work we have an Instron 3369 machine for material testing. Recently, I wanted to visualize some tensile test data in ways that I couldn’t get into the test report.

  4. Python bindings for libmagic

    This documents how I installed Python bindings for libmagic.

    There are actually different bindings for libmagic. One set is part of the original distribution. It can be found in /usr/src/contrib/file/python/. But in my opinion it is somewhat cumbersome to use and not very Pythonic.

    The implementation from ahupp/python-magic in Github feels more natural.

  5. Managing configuration files with ‘deploy’

    The deploy script is a program for managing configuration files. This script grew out of my need for a multi-functional installer for configuration files. I tend to keep those files in a separate git repository rather than changing my $HOME into a git repository.


Page 1 / 3 Page 2 →