---
title: Python-ing it better - Best Software Development Team Extension Partner for Nordics
description: Where I work; we are obsessed with python, we use it everyday and to us python is an art. Python does not force rules unto you. But there’s always a better
image: https://www.craftsmensoftware.com/hubfs/Imported_Blog_Media/Python-ing-it-better.webp
---

[Skip to main content](https://www.craftsmensoftware.com/blog/python-ing-it-better#main-content)

[![Craftsmen-logo](https://www.craftsmensoftware.com/hs-fs/hubfs/Website%202.png?width=200&height=72&name=Website%202.png) ![Craftsmen-logo](https://www.craftsmensoftware.com/hs-fs/hubfs/Website%202.png?width=200&height=72&name=Website%202.png) ![Craftsmen-logo](https://www.craftsmensoftware.com/hs-fs/hubfs/Website%202.png?width=200&height=72&name=Website%202.png) ![Craftsmen-logo](https://www.craftsmensoftware.com/hs-fs/hubfs/Website%202.png?width=200&height=72&name=Website%202.png)](https://www.craftsmensoftware.com)

- [About us](https://www.craftsmensoftware.com/about-us)
- [Client Stories](https://www.craftsmensoftware.com/client-success-stories)
- [How We Work](https://www.craftsmensoftware.com/how-we-work)
- [Case Study](https://www.craftsmensoftware.com/case-study)
- [Blog](https://www.craftsmensoftware.com/blog)
- [Career](https://careers.craftsmensoftware.com/)

Open main navigation

Close main navigation

- [About us](https://www.craftsmensoftware.com/about-us)
- [Client Stories](https://www.craftsmensoftware.com/client-success-stories)
- [How We Work](https://www.craftsmensoftware.com/how-we-work)
- [Case Study](https://www.craftsmensoftware.com/case-study)
- [Blog](https://www.craftsmensoftware.com/blog)
- [Career](https://careers.craftsmensoftware.com/)
- [Get In Touch](https://www.craftsmensoftware.com/contact-us)

[Get In Touch](https://www.craftsmensoftware.com/contact-us)

## Python-ing it better

![Python-ing it better](https://www.craftsmensoftware.com/hs-fs/hubfs/Imported_Blog_Media/Python-ing-it-better.webp?width=1200&height=820&name=Python-ing-it-better.webp)

Where I work; we are obsessed with python, we use it everyday and to us python is an art. Python does not force rules unto you. But there’s always a better way of doing it; to us, a pythonic way. This article will try to show off some cool tricks and good practices in python that you can use to level up in the art of python.

## Using built in functions

Most of us start our coding career with C/C++. Which is great and all but it drills in a certain way of doing things that we carry with us throughout the year and that is “assign then modify”. Lets talk code

`#include <iostream> #include <vector> using namespace std; int main () { vector<int> intVector; for( int i=0; i < 5; i++) { intVector.push_back (i); } return 0; }` 

 Copy

 

We declare an empty vector and then loop over it to populate. There’s nothing wrong with it and it works absolutely OKAY. Lets convert this to python

`int_list: List[int] = [] for i in range(5): int_list.append(i)` 

 Copy

 

Nothing wrong here either. But… 

![Image 1](https://www.craftsmensoftware.com/hs-fs/hubfs/Imported_Blog_Media/no-michael-scott.gif?width=220&height=179&name=no-michael-scott.gif)

There’s gotta be a better, more pythonic way of doing this

`int_list: List[int] = list(map(lambda i: i, range(5)))` 

 Copy

 

Wow. The map function can call a given function for every element of a given iteratables. We can use this for loads of stuff like-

`dict_list: List[Dict[Literal["id", "session"], Union[int, str]]] = [{"id": 1}, {"id": 2}] mod_list = list( map(lambda element: {**element, "session": True}, dict_list))` 

 Copy

 

Cool right? Say we need to get all the elements with session=True. Let’s do it the boring way first!

`dict_list: List[Dict[Literal["id", "session"], Union[int, str]]] = [{"id": 1}, {"id": 2, "session": True}, {"id": 3, "session": True}] filtered_session: List[Dict[Literal["id", "session"], Union[int, str]]] = [] for element in dict_list: if element.get("session", False): filtered_session.append(element)` 

 Copy

 

Looks OKAY, gets the job done but ew, we need a pythonic way. Here’s one:

`dict_list: List[Dict[Literal["id", "session"], Union[int, str]]] = [{"id": 1}, {"id": 2, "session": True}, {"id": 3, "session": True}] filtered_list = list( filter(lambda element: element.get("session", False), dict_list))` 

 Copy

 

Wow. What if you only need the first match? Don’t you worry, don’t you worry child, python’s got a plan for you!

`filtered_first_match = next( filter(lambda element: element.get("session", False), dict_list)) # Be careful of StopIteration Exception` 

 Copy

 

Python has a plethora of built in functions that you can use to write clean self-explained code. Please use them and LEVEL UP.

## Comprehending Comprehensions

Python is an art. There are a number of ways to do what you need to do. You’re the painter, python is the brush. Move it the way you want.

Comprehensions are one off lines in python that can do many things in a more clear, comprehensible, concise way. Let’s get back to the first example from the previous section. How can we achieve the same thing with comprehension? Let’s talk code!

`int_list = [i for i in range(5)]` 

 Copy

 

It can’t get any prettier than this ladies and gentlemen. This is the beauty of python. You can use list comprehensions with almost every data type. Need a dictionary? Well…

`dict_ints = {i: "wow" for i in range(5)}` 

 Copy

 

Talk about beauty. And you can do this with generators as well!

`generatored = (i for i in ["a", "b"]) for gen in generatored: print(gen)` 

 Copy

 

And with sets too!

`set_ing = {i for i in range(4)}` 

 Copy

```
 
```

```
Impressed? You should be.
```

## Needle in the thread

Have you ever had to make a bunch of API calls and ended up doing it like this-

`import requests list_of_urls = ["https://jsonplaceholder.typicode.com/todos/1", "https://jsonplaceholder.typicode.com/todos/2", "https://jsonplaceholder.typicode.com/todos/3"] fetched_data = [] for url in list_of_urls: fetched_data.append(requests.get(url).json())` 

 Copy

 

OKAY. But unfortunately I don’t have a tree full of time to wait for these to come in one by one. So let’s clear this up.

`import requests list_of_urls = ["https://jsonplaceholder.typicode.com/todos/1", "https://jsonplaceholder.typicode.com/todos/2", "https://jsonplaceholder.typicode.com/todos/3"] fetched_data = list(map(lambda url: requests.get(url).json(), list_of_urls))` 

 Copy

 

This is my reaction after seeing this

![Image 2](https://www.craftsmensoftware.com/hs-fs/hubfs/Imported_Blog_Media/200.gif?width=200&height=200&name=200.gif)

But I still don’t have time. Can you speed it up?

`import requests from concurrent.futures import ThreadPoolExecutor list_of_urls = ["https://jsonplaceholder.typicode.com/todos/1", "https://jsonplaceholder.typicode.com/todos/2", "https://jsonplaceholder.typicode.com/todos/3"] with ThreadPoolExecutor(max_workers=min(len(list_of_urls), 4)) as exe_cutiepie: fetched_data = list(exe_cutiepie.map( lambda url: requests.get(url).json(), list_of_urls))` 

 Copy

 

I mean

![Image 3](https://www.craftsmensoftware.com/hs-fs/hubfs/Imported_Blog_Media/perfection-perfect.gif?width=220&height=149&name=perfection-perfect.gif)

I hope this was able to demonstrate the beauty of python and how you can LEVEL UP as a developer. There are some caveats and gotchas when it comes to shortening codes so remember to use them wisely.

![Sakib Alam](https://www.craftsmensoftware.com/hs-fs/hubfs/MD%20SAKIBUL%20ALAM.png?width=120&height=120&name=MD%20SAKIBUL%20ALAM.png)

Author: **[Sakib Alam](https://www.craftsmensoftware.com/blog/author/sakib-alam)**  
 12/01/2019

![Hire AI-Native Engineers](https://www.craftsmensoftware.com/hubfs/Z63_3132.webp)

## Hire AI-Native Engineers

[![Book A Strategy Call](https://www.craftsmensoftware.com/hubfs/Book%20A%20Strategy%20Call.svg)](https://www.craftsmensoftware.com/contact-us)

### **About Craftsmen**

[The Team](https://www.craftsmensoftware.com/about-us)

[Our Partnership Model](https://www.craftsmensoftware.com/how-we-work)  
[Career](https://careers.craftsmensoftware.com/)

[FAQ](https://www.craftsmensoftware.com/frequently-asked-questions-faq)  
[Privacy Policy](https://www.craftsmensoftware.com/privacy-policy-best-software-development-company-in-bangladesh) 

[Craftsmen LinkedIn Page](https://linkedin.com/company/craftsmensoftware)   [Craftsmen Facebook Page](https://www.facebook.com/craftsmenltd/)   [Craftsmen Youtube Page](https://www.youtube.com/@craftsmensoftware)

### **Headquarter**

**Craftsmen UK**  
One Sovereign Quay, Bridge End, Leeds, West Yorkshire LS1 4AG United Kingdom 

**Operational Hub

Craftsmen Bangladesh**  
Plot # 316, Lane # 4, DOHS Baridhara,

Dhaka - 1206, Bangladesh

### **Sales & Partnership Offices**

**Craftsmen Norway**  
Kong Oscars gate 66, 68, 5017 Bergen, Norway

**Craftsmen France**  
6 Avenue Pierre Grenier, 92100 Boulogne-Billancourt, Paris, France

### **A Team You Can Trust**

#### [![ISO Certificates New](https://www.craftsmensoftware.com/hs-fs/hubfs/ISO%20Certificates%20New.png?width=300&height=96&name=ISO%20Certificates%20New.png)](https://www.craftsmensoftware.com/trust-centre)

[![glassdoor (1)](https://www.craftsmensoftware.com/hs-fs/hubfs/glassdoor%20(1).png?width=110&height=79&name=glassdoor%20(1).png)](https://www.glassdoor.com/Overview/Working-at-Craftsmen-EI_IE3004266.11,20.htm) [![goodfirms.co](https://www.craftsmensoftware.com/hs-fs/hubfs/goodfirms.co.webp?width=110&height=95&name=goodfirms.co.webp)](https://www.craftsmensoftware.com/blog/craftsmen-thrives-at-goodfirms-by-offering-scalable-robust-software-solutions-developed-with-quality-by-maestros)

 

 © 2026 Craftsmen. All rights reserved.

```json
{
  "@context" : "https://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Sakib Alam",
    "url" : "https://www.craftsmensoftware.com/blog/author/sakib-alam"
  },
  "dateModified" : "2026-04-30T11:36:01.742Z",
  "datePublished" : "2019-01-11T18:15:00.000Z",
  "headline" : "Python-ing it better - Best Software Development Team Extension Partner for Nordics",
  "image" : [ "https://www.craftsmensoftware.com/hubfs/Imported_Blog_Media/Python-ing-it-better.webp" ],
  "mainEntityOfPage" : {
    "@id" : "https://www.craftsmensoftware.com/blog/python-ing-it-better",
    "@type" : "WebPage"
  },
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://www.craftsmensoftware.com/hubfs/Craftsmen%20Logo_Black.png"
    },
    "name" : "Craftsmen Ltd."
  }
}
```

```json
{
  "@context" : "https://schema.org",
  "@type" : "SoftwareCompany",
  "address" : [ {
    "@type" : "PostalAddress",
    "addressCountry" : "Norway",
    "addressLocality" : "Oslo"
  }, {
    "@type" : "PostalAddress",
    "addressCountry" : "United Kingdom",
    "addressLocality" : "London"
  }, {
    "@type" : "PostalAddress",
    "addressCountry" : "France",
    "addressLocality" : "Paris"
  }, {
    "@type" : "PostalAddress",
    "addressCountry" : "United States",
    "addressLocality" : "New York"
  }, {
    "@type" : "PostalAddress",
    "addressCountry" : "Bangladesh",
    "addressLocality" : "Dhaka"
  } ],
  "areaServed" : [ {
    "@type" : "Country",
    "name" : "Norway"
  }, {
    "@type" : "Country",
    "name" : "Sweden"
  }, {
    "@type" : "Country",
    "name" : "United Kingdom"
  }, {
    "@type" : "Country",
    "name" : "France"
  }, {
    "@type" : "Country",
    "name" : "United States"
  }, {
    "@type" : "Country",
    "name" : "Bangladesh"
  } ],
  "description" : "Trusted AI-native engineering partner providing software team extension, IT staff augmentation, and dedicated developer teams globally.",
  "logo" : "https://www.craftsmensoftware.com/hubfs/logo.png",
  "name" : "Craftsmen Software",
  "url" : "https://www.craftsmensoftware.com"
}
```