Roland's homepage

My random knot in the Web

Articles tagged with "python"

  1. 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.

  2. Parallel execution with Python

    With Python it is relatively easy to make programs go faster by running things in parallel on multiple cores. This article shows you how.

    We sill concentrate on a type of problem that is easy to parallelize.

  3. 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.

  4. Switching IPython to Python 3

    More and more, IPython has become my tool of choice as the ultimate calculator and to try out concepts and code for use in my programs.

    While I generally use the terminal-based interactive shell, notebooks offer more capabilities for integrating text, formulas and graphics.

    With Python 2.7 effectively mostly ...

  5. TeXcalc

    As an engineer, I often do diverse calculations that I want to save in my logbooks which I write in LaTeX. Up to now I’ve either formatted those by hand or used the listings package to include calculations made in IPython.

  6. Stltools

    From the release of version 3.2, the py-stl software has been renamed to stltools. The reason I made this change mostly has to do with how FreeBSD handles packages. Programs that require an interpreter are prefixed with its name and version. So py-stl would become py27-py-stl, which would be ...

  7. Python number conversions

    Sometimes one has to convert numbers from and to different formats. Below are some examples in Python that I picked up over time. What you see are excerpts of IPython sessions.

    To and from hexadecimal (base 16):

    In [1]: hex(100)
    Out[1]: '0x64'
    
    In [2]: int(0xa7)
    Out[2 ...

Page 1 / 2 Page 2 →