Open in app
Home
Notifications
Lists
Stories

Write
Herman Michaels
Herman Michaels

31 Followers

Home

Published in Better Programming

·18 hours ago

How to Setup Data Classes in Python

Efficient data management with Python dataclass using frozen and property — In a previous post, I gave an introduction to Python decorators. Today we’ll have a closer look at some built-in decorators — in particular those which can be used for the broad topic of “managing data”. …

Programming

4 min read

How to Setup Data Classes in Python
How to Setup Data Classes in Python
Programming

4 min read


Published in Better Programming

·5 days ago

Python’s GIL vs. C++ With Mutexes

Python’s GIL explained through a multi-threaded application example — This article will look at Python’s Global Interpreter Lock — GIL. We will cover what it is, why it is there and what advantages/disadvantages it brings, and then cap off this article with a practical example. We compare a simple multi-threaded application in Python and C++ and show how the…

Programming

5 min read

Python’s GIL vs. C++ With Mutexes
Python’s GIL vs. C++ With Mutexes
Programming

5 min read


6 days ago

Variable Scopes in Python

Understanding the ‘LEGB’ Rule — In Python, there are four different variable scopes: Local, Enclosing, Global, Built-in. This leads to the ‘LEGB’ rule, which defines how Python resolves / looks up names. In this post we will introduce all scopes with examples, and also show how one can ‘interact’ between these — e.g. …

Python

4 min read

Variable Scopes in Python
Variable Scopes in Python
Python

4 min read


Nov 21

Closures in Python

About Data Hiding and Small Class Alternatives — In Python, a closure is a nested function, which accesses variables from its enclosing scope, and is returned by another function. This can be useful to avoid small classes containing only a single function, promotes data hiding and offers alternatives to global variables. In this article we’ll first introduce and…

Python

4 min read

Closures in Python
Closures in Python
Python

4 min read


Nov 18

Logging in Python

Python Shorts — Part 7 — Logging is a powerful introspection tool, and a must for any professional software project. With it, we can keep track of our application’s execution, follow progress, find bugs and overall improve debugging. Luckily, Python offers a convenient standard library logging module, satisfying all those requirements. One good question to start…

Python

2 min read

Logging in Python
Logging in Python
Python

2 min read


Nov 16

Generating Temporary Files and Directories in Python

Python Shorts — Part 6 — Developers often need some temporary files or folders, e.g. for unit tests, or just to store any kind of temporary information. For this purpose, they don’t care where these files are placed, how they are named, etc. One way of achieving this would be create some file / directory manually…

Python

2 min read

Generating Temporary Files and Directories in Python
Generating Temporary Files and Directories in Python
Python

2 min read


Nov 15

Optional Arguments in C++

Using std::optional — Python developers, for example, are very used to “optional” arguments. By this I mean arguments which do not just have a default value (e.g. int arg = -1), but can be None, too — i.e. you really do not have to pass them, they can be “undefined”. Why you might…

Cpp

3 min read

Optional Arguments in C++
Optional Arguments in C++
Cpp

3 min read


Nov 12

Python Decorators

Modifying Functions — In this post I’ll describe decorators in Python — a powerful tool to customise function behaviour, and a true enrichment for every programmer and program. Most tutorials on this start with a lengthy introduction into what functions in Python are (first class objects), and what we can do with them…

Python

3 min read

Python Decorators
Python Decorators
Python

3 min read


Nov 10

Managing Resources in Python with Context Managers (with statement)

Python Shorts — Part 5 In this post we will have a look at context managers in Python. These are used via the with … statement, and work well e.g. for managing resources. In these use-cases, we want to acquire and make use of an resource, and eventually free it…

Python

2 min read

Managing Resources in Python with Context Managers (with statement)
Managing Resources in Python with Context Managers (with statement)
Python

2 min read


Nov 9

Advanced Iteration in Python with enumerate() and zip()

Python Shorts — Part 4 — In this post we will take a look at some advanced iteration tools in Python — in particular enumerate() and zip(). Enumerate Sometimes, you might want to iterate over an iterable, accessing all its elements — while simultaneously keeping track of the iteration number, e.g.: file_counter = 0 for file in files…

Python

2 min read

Advanced Iteration in Python with enumerate() and zip()
Advanced Iteration in Python with enumerate() and zip()
Python

2 min read

Herman Michaels

Herman Michaels

31 Followers

PhD in ML, working as research / software engineer.

Following
  • Veronica Llorca-Smith 💎

    Veronica Llorca-Smith 💎

  • Love Doctor

    Love Doctor

  • Canx1

    Canx1

  • ODSC - Open Data Science

    ODSC - Open Data Science

  • CPF Coaching

    CPF Coaching

Help

Status

Writers

Blog

Careers

Privacy

Terms

About

Text to speech