Language Selection

English French German Italian Portuguese Spanish

Python Programming Leftovers

Filed under
  • Logistic Regression in Python

    As the amount of available data, the strength of computing power, and the number of algorithmic improvements continue to rise, so does the importance of data science and machine learning. Classification is among the most important areas of machine learning, and logistic regression is one of its basic methods. By the end of this tutorial, you’ll have learned about classification in general and the fundamentals of logistic regression in particular, as well as how to implement logistic regression in Python.

  • Szorc: Mercurial's Journey to and Reflections on Python 3

    Here is a longish blog entry from Mercurial maintainer Gregory Szorc on the painful process of converting Mercurial to Python 3.

  • Mercurial's Journey to and Reflections on Python 3

    Mercurial 5.2 was released on November 5, 2019. It is the first version of Mercurial that supports Python 3. This milestone comes nearly 11 years after Python 3.0 was first released on December 3, 2008.

    Speaking as a maintainer of Mercurial and an avid user of Python, I feel like the experience of making Mercurial work with Python 3 is worth sharing because there are a number of lessons to be learned.

    This post is logically divided into two sections: a mostly factual recount of Mercurial's Python 3 porting effort and a more opinionated commentary of the transition to Python 3 and the Python language ecosystem as a whole. Those who don't care about the mechanics of porting a large Python project to Python 3 may want to skip the next section or two.


    This effort began in earnest in June 2015 with global source code rewrites like using modern octal syntax, modern exception catching syntax (except Exception as e instead of except Exception, e), print() instead of print, and a modern import convention along with the use of from __future__ import absolute_import.

    In the early days of the port, our first goal was to get all source code parsing as valid Python 3. The next step was to get all the modules importing cleanly. This entailed fixing code that ran at import time to work on Python 3. Our thinking was that we would need the code base to be import clean on Python 3 before seriously thinking about run-time behavior. In reality, we quickly ported a lot of modules to import cleanly and then moved on to higher-level porting, leaving a long-tail of modules with import failures.

    This initial porting effort played out over months. There weren't many people working on it in the early days: a few people would basically hack on Python 3 as a form of itch scratching and most of the project's energy was focused on improving the existing Python 2 based product. You can get a rough idea of the timeline and participation in the early porting effort through the history of test-check-py3-compat.t. We see the test being added in December 2015, By June 2016, most of the code base was ported to our modern import convention and we were ready to move on to more meaningful porting.

More in Tux Machines

today's howtos

Devices/Embedded With GNU/Linux

Easy Librem 5 App Development: Flashlight

In my first post on easy application development on the Librem 5 I discussed how to turn a simple shell script that takes a screenshot into a full graphical app with only a few extra lines of code. In this post I will follow up with an even simpler application that took about twenty minutes to write with much of that time involved in reading documentation. My Bright Idea The interesting thing about smart phones is how many other devices they have replaced beyond a regular phone. For instance, there used to be a market for small, pocket-sized digital cameras, but now many people just use the cameras on their smart phones. While some people still do keep a pocket flashlight with them, many people just use the light on their smart phone. I realized that a flashlight app would be another great way to showcase just how easy it is to develop applications for the Librem 5. As applications go the requirements are pretty simple: you need a button to turn on the light, a button to turn off the light, and a button to close the app. Read more

LibreOffice Writer Articles and Improvements

  • Two alternatives to Microsoft Word that are free and customizable

    If you're looking for an open-source office suite, LibreOffice is the software package for you. Its word processing program is LibreOffice Writer--which, incidentally, this story was written with, so I can attest to its excellence. You're able to choose from different fonts and text styles, embed images and figures, and use a variety of other functions you'd expect from its paid competition. It can save files in an Open Document Format (ODF), a number of Word formats, and export your work as a PDF for wide-ranging compatibility.

  • Improved rotated text handling in Writer's table rows with automatic height

    Writer now has better support for rotated text in tables containing rows with automatic height. This post also presents two related fixes. First, thanks Otevřená města who made this work by Collabora possible. [...] Before diving into improved rotated text handling, first a continuous section break import problem (tdf#128605) was fixed: this was a case when we created a new page style, but only a new section was intended.