- Details
- Written by: Jason Ross
One of the Python features that gets a lot of publicity is list comprehension and, to a lesser extent, dictionary comprehension. It sounds very complex, and it’s very a very popular subject in technical interviews, but it’s really just syntactic sugar – something the interpreter uses to let you simplify your code.
Read more: Python List Comprehensions and Dictionary Comprehensions
- Details
- Written by: Jason Ross
The version of Python installed on the Raspberry Pi operating system is usually a few versions behind the latest. If this matters to you there's a good chance you will want to update it.
You can't use apt
to install the latest version of Python, because it's not available as a package. It's not available as a pre-built installation package from python.org either, so you'll have to built it. It's not too difficult to do this, although there is a problem with the build that I describe how to fix here, so here's how to do it.
Read more: Installing a New Version of Python On A Raspberry Pi
- Details
- Written by: Jason Ross
When you create a system, you want it to run as quickly as possible. Most of the time, this isn’t a problem, but eventually you’ll find yourself in a situation where the performance isn’t as good as you’d like or need.
At this point you have a few options: at first you might decide to throw more CPU power and memory at the problem. This is usually the approach people mean when they tell you that “CPU and memory are cheap!”. If you do this, things will probably improve for a while, before you’re back in the same position again. If you’re using a cloud-based system, you’ll also have a bigger recurring cloud bill and less money in your bank account. So, as always, it’s best to ignore anyone who tells you how “cheap” CPU and memory are.
Read more: Concurrency, Multiprocessing, Multi-threading and Asynchronous Code
- Details
- Written by: Jason Ross
Infra-red imaging – where different temperatures are shown on a screen as different colours – is used in things from search and rescue to tracking targets from the air, and from paranormal investigation to draught detection. All of this struck me as interesting, so I wanted to give it a try. A few years ago I saw a FLIR camera at work, and it was impressive. The cost was horrendous though. Since then I’ve seen some other infra-red cameras, some with built-in displays, and some that plug into cellphones, but they’ve all had disadvantages. Some depended on the cellphone having the "right" type of USB connector and client software, some took far too long for delivery because they were built in China and some just weren't very good at all.
In the end, I decided I’d try something a little different. Panasonic make an infrared sensor, the Grid-EYE AMG8833, which is nowhere near as expensive as any of the other devices available. It can connect to a Raspberry Pi or an Arduino, and I’ve got a couple of Raspberry Pis hanging around. This seemed to be a decent way to get into infra-red imaging without spending too much
Read more: Infra-Red Imaging With The Grid-EYE AMG8833 Sensor
- Details
- Written by: Jason Ross
Along with iteration, recursion is one of the basic principals of software engineering. It can be a graceful solution to problems, but it's often misunderstood and it can have practical disadvantages.
- Details
- Written by: Jason Ross
Wordpress is a great site Content Management System (CMS). I've been using it a little - not for this site - and it works well. The only real problem I've encountered is that sometimes you want to add a plugin, and the menu entry that lets you do that isn't there.
- Details
- Written by: Jason Ross
Using Poetry to manage Python dependencies and virtual environments is much easier than the traditional requirements.txt
and other tools. When you want to release your package and make it available on PyPI, Poetry also lets you avoid the need to use the standard Python setuptools
setup.cfg
or setup.py
files, so it's much simpler and less confusing. If you'd like a brief introduction to Poetry, I'd recommend this article: Five Minute Introduction: Poetry.
Read more: How To Use Poetry to Publish a Python Package on PyPI