NOT FOUND

We couldn't find the page you were looking for. But we have great articles to get you started!

Illustration of two scientists programming in Python
2021-03-27 Instructions to build the Python for the Lab DAQ.

The PFTL DAQ is the ideal companion to follow the book Python for the Lab. Building the device itself is not part of the book because it focuses on Python best practices and not on lower-level electronics. In this article, we will quickly see how to build the device to …

Read Article
2021-03-21 Using slots in Python: limit dynamic attribute creation and improve speed

When we create classes, one of the biggest challenges is understanding how to handle dynamic attribute creation. Slots have the benefit of limiting attribute creation at runtime. In this article, we will explore how slots work, including a quick overview of how classes store attributes internally.

Dynamic attribute creation

One …

Read Article
2021-02-27 Acquiring images from Basler Cameras

Basler offers a wide range of cameras that can be used for microscopy, computer vision, or even as security cameras. One of the cameras' advantages is that they come with a software development kit that makes them easy to integrate into our projects. Basler puts continuous effort into maintaining PyPylon …

Read Article
2021-01-16 Singletons: Instantiate objects only once

When developing more extensive programs, being aware of different patterns can significantly help us solve problems even before they arise. One of those patterns is the creation of singletons, which are nothing else but objects that can be instantiated only once. In Python, we are exposed to singletons since the …

Read Article
2020-06-13 Differences of Multiprocessing on Windows and Linux

Multiprocessing is an excellent package if you ever want to speed up your code without leaving Python. When I started working with multiprocessing, I was unaware of the differences between Windows and Linux, which set me back several weeks of development time on a relatively big project. Let's quickly see …

Read Article
2020-05-25 Python Tip: Using Else with Loops

Most likely, you are aware of how to use the else statement with an if clause. However, Python also allows us to use them with loops. They are straightforward to understand and open some exciting possibilities. Before continuing, remember that else in this context should be called no-break.

Let's quickly …

Read Article
2020-05-18 Python Tip: Ready to Publish Matplotlib Figures

Saving figures for publications, presentations, books, or websites can be a cumbersome task but doesn't need to be. In this Python Tip, we will see how to create images using Matplotlib that are ready to be embedded. We will take care of the most important aspects: shape, font sizes, and …

Read Article
2020-05-16 Data Descriptors: Bringing Attributes to the Next level

Descriptors in Python allow us to control how attributes of classes are accessed or modified. A pattern often encountered is defining properties to use setter and getter methods encapsulated as if they were a single attribute. In this article, we will dig into how the property decorator works, to understand …

Read Article
2020-05-11 Python Tips: Using Sets

Most people are familiar with lists, tuples, and dictionaries as the basic data types for grouping information. However, there is another convenient option: sets. They are directly linked to the mathematical idea of a set. To define them, we can use the following syntax:

var = {1, 2, 3, 4}

We …

Read Article
2020-04-10 Generators, Iterables, Iterators in Python: When and Where

Generators, Iterables, and Iterators are some of the most used tools in Python. However, we don't often stop to think about how they work, how we can develop our generators and iterables. Once you learn what you can do with them, it is possible to expand your toolbox and make …

Read Article