Python Programming

Posts related to Python programming language

Implementing Data Formatters – Python Edition (part 2 of 2)

This is a continuation blog. Please read Part 1 first, before reading this. Version 2: Component Based Let’s say that the data is no longer a dictionary or something that isn’t readily serialized by XML or JSON modules. For simplicity sake, let’s just create an object version of the data in part 1: Complex Data …

Implementing Data Formatters – Python Edition (part 2 of 2) Read More »

Implementing Data Formatters – Python Edition (part 1 of 2)

This will most likely be useful to you if you’re doing web applications (web services or web APIs) but the idea would still be applicable for other use cases. Since there’s really no standard way of rendering data, we usually have to support multiple format. In this blog, we’ll cover the most common formats in …

Implementing Data Formatters – Python Edition (part 1 of 2) Read More »

Callable Classes in Python, VB.Net and VB6

Let’s do some multiverse madness here and do something specific but do it across different programming languages! 🙂 For this one, let’s make the class or rather the instance of it — callable; that is, instead of the client invoking its method, we invoke itself. What do I mean by this? Most of us call …

Callable Classes in Python, VB.Net and VB6 Read More »

Using Functions for Dependency Injection and as Callback in Python

Although implementing Dependency Injection design pattern and Callbacks can be implemented in most programming languages (even in VB6), it’s just cleaner/neater to do in Python. These are also scenarios or use cases where you intentionally would pass the function object instead of it’s return value. Function as dependency To write a function that behaves differently …

Using Functions for Dependency Injection and as Callback in Python Read More »

When to and Why Use Parentheses in Python

One of the important (and usually confusing) concepts a developer needs to understand in Python is the use (or omission) of parentheses. This may seem so trivial, even obvious but it’s something that can cause problems to a lot of programmers, especially new ones coming from a different programming language. At best it could cause …

When to and Why Use Parentheses in Python Read More »

Python Environments

If you’re working on different projects, especially large projects, you should be using Python Environments. So what is a Python Environment and why should I care? The best definition is the one from the official documentation: The venv module provides support for creating lightweight “virtual environments” with their own site directories, optionally isolated from system site directories. …

Python Environments Read More »