Python Icon


Python is a dynamically typed programming language.
279 Stories
All Topics


Ruby vs Python comes down to the for loop

Doug Turnbull breaks down a major difference between two beloved programming languages in how they handle iteration.

Python embraces for. Objects tell for how to work with them, and the for loop’s body processes what’s given back by the object. Ruby does the opposite. In Ruby, for itself (via each) is a method of the Object. The caller passes the body of the for loop to this method.

He goes on to give examples and explain why each approach might map to different developers’ brains… differently. Here’s a succinct summary, if you don’t have time for the deeper discussion:

In Ruby, the objects control the affordances. In Python, the language does.


An open source, online reverse dictionary

This is the first time I’ve heard of a reverse dictionary, but now that I have… so cool!

Opposite to a regular (forward) dictionary that provides definitions for query words, a reverse dictionary returns words semantically matching the query descriptions.

Ever had a word on the tip of your tongue and you Just. Can’t. Think of it?! Reverse dictionary!

An open source, online reverse dictionary


Hummingbot – a client for crypto market making

Hummingbot integrates cryptocurrency trading on both centralized exchanges and decentralized protocols. It allows users to run a client that executes customized, automated trading strategies for cryptocurrencies.

We created Hummingbot to promote decentralized market-making: enabling members of the community to contribute to the liquidity and trading efficiency in cryptocurrency markets.

There are many arbitrage opportunities between centralized exchanges like Coinbase and Binance (which often have high liquidity) and decentralized exchanges like Loopring and Terra (which thus far rarely have high liquidity).

If you have the financial stomach for it, Hummingbot could help you take advantage of these opportunities while providing liquidity to the decentralized markets.


Where does all the effort go? Looking at Python core developer activity

Łukasz Langa was tasked by the PSF to look at the state of CPython as an active software development project.

What are people working on? Which standard libraries require most work? Who are the active experts behind which libraries? Those were just some of the questions asked by the Foundation. In this post I’m looking into our Git repository history and our Github PR data to find answers.

Follow along as Łukasz explains how they gathered the data, analyzed it, and got answers to the questions above.

Raspberry Pi

MagInkCal syncs your Google calendar with a framable e-ink display

This incredibly cool DIY e-ink calendar uses a Raspberry Pi Zero WH to do its thing. Here’s how it works:

Through PiSugar2’s web interface, the onboard RTC can be set to wake and trigger the RPi to boot up daily at a time of your preference. Upon boot, a cronjob on the RPi is triggered to run a Python script that fetches calendar events from Google Calendar for the next few weeks, and formats them into the desired layout before displaying it on the E-Ink display. The RPi then shuts down to conserve battery. The calendar remains displayed on the E-Ink screen, because well, E-Ink…

MagInkCal syncs your Google calendar with a framable e-ink display


A desktop app for JupyterLab (based on Electron)

If you already know what JupyterLab is, then I don’t have to tell you why this might be exciting/useful. If you don’t, well, here’s what JupyterLab is:

JupyterLab is the next-generation user interface for Project Jupyter offering all the familiar building blocks of the classic Jupyter Notebook (notebook, terminal, text editor, file browser, rich outputs, etc.) in a flexible and powerful user interface. JupyterLab will eventually replace the classic Jupyter Notebook.

A desktop app for JupyterLab (based on Electron)

Will McGugan

Free code reviews for open source Python projects

Will McGugan is a full-stack developer and Python expert who is offering up free reviews for any/all qualifying open source projects.What a great idea/service to the community!

The reviews will focus on API design and general architection of your project with a view to making them a) more maintainable b) future proof and c) user friendly, but will avoid anything that a linter could do for you. Reviews are intended to be constructive and hopefully give advice you can act on, but are in no way a “grade”.

I won’t need to run your code to do a review and reviews aren’t intended to fix bugs.

All reviews will be public and will be published in the repo in a markdown file. An exception would be for any security issues, where I would notify you first.

Not everyone all at once, now. There’s already quite a few requests in the queue.


Harbormaster – easily deploy many Docker-Compose apps on a single host

Here’s their pitch:

Do you have a home server you want to run a few apps on, but don’t want everything to
break every time you upgrade the OS? Do you want automatic updates but don’t want to buy
an extra 4 servers so you can run Kubernetes?

Do you have a work server that you want to run a few small services on, but don’t want
to have to manually manage it? Do you find that having every deployment action be in
a git repo more tidy?

Harbormaster is for you.

You create a YAML config file with all the git repos you want it to include and it’ll watch them for changes (on a timer) and do the necessary cloning/pulling, service restarting, etc. that needs doing to make it all run. Simple. Neat!

AI (Artificial Intelligence)

Jina – build search-as-a-service powered by deep learning in just minutes

Jina calls itself a “cloud-native neural search framework”. What is neural search, exactly?

The core idea of neural search is to leverage state-of-the-art deep neural networks to build every component of a search system. In short, neural search is deep neural network-powered information retrieval. In academia, it’s often called neural IR.

And what can it do for you?

Thanks to recent advances in deep neural networks, a neural search system can go way beyond simple text search. It enables advanced intelligence on all kinds of unstructured data, such as images, audio, video, PDF, 3D mesh, you name it.

For example, retrieving animation according to some beats; finding the best-fit memes according to some jokes; scanning a table with your iPhone’s LiDAR camera and finding similar furniture at IKEA. Neural search systems enable what traditional search can’t: multi/cross-modal data retrieval.

This project looks quite established and collaborative. 172 contributors and counting…


A self-hosted, ad-free, privacy-respecting metasearch engine

Get Google search results, but without any ads, javascript, AMP links, cookies, or IP address tracking. Easily deployable in one click as a Docker app, and customizable with a single config file. Quick and simple to implement as a primary search engine replacement on both desktop and mobile.

Includes quick deployment to Heroku, Replit, and Fly. Or you can run it locally, of course via standard Python tooling or Docker.


A digital image forensic toolset

Sherloq is a personal research project about implementing a fully integrated environment for digital image forensics. It is not meant as an automatic tool that decide if an image is forged or not (that tool probably will never exist…), but as a companion in experimenting with various algorithms found in the latest research papers and workshops.

The original version was written in C++ in 2015, but a port to Python is in the works. It looks super useful, but buyer beware:

I’m happy to share my code and get in contact with anyone interested to improve or test it, but please keep in mind that this repository is not intended for distributing a final product, my aim is just to publicly track development of an unpretentious educational tool, so expect bugs, unpolished code and missing features! ;)

A digital image forensic toolset

Brett Cannon

Introducing the Python launcher for Unix

Brett Cannon:

… over 3 years ago I set out to re-implement the Python Launcher for Unix in Rust. On July 24, 2021, I launched 1.0.0 of the Python Launcher for Unix… This gives you a py command on Unix which will always use the newest version of Python.

He goes on to describe some workflow niceties that a built in and also what this project is not about:

The Launcher is purely a convenience and not meant to be The Launcher For All Things; this should never end up in a Docker container.

Ned Batchelder

On reading code with your eyebrows

Ned Batchelder, after reading some code to termine whether or not it was “Pythonic”:

My first response was that I don’t like this code, because I had to read it with my eyebrows. That is, I furrow my brow, and read slowly, and scowl at the code as I puzzle through it. This code is dense and tricky.

Is it Pythonic? I guess in the sense that it uses a number of Python-specific constructs and tools, yes. But not in the sense of Python code being clear and straightforward. It uses Python thoroughly, but misses the spirit.

(He then rewrites it in a way that he likes. Which solution do you prefer?)

I’m no Pythonista, so I don’t know what is or isn’t “Pythonic”. However, I do know that I love the phrase, “read it with my eyebrows”, because I’ve quite literally done this my entire career. I used to invoke my eyebrows and conclude that I was just bad at reading code. Now when I invoke them I conclude that the code I’m reading is bad.

Martin Heinz

The unknown features of Python's `operator` module

At the first glance Python’s operator module might not seem very interesting. It includes many operator functions for arithmetic and binary operations and a couple of convenience and helper functions. They might not seem so useful, but with help of just a few of these functions you can make your code faster, more concise, more readable and more functional. So, in this article we will explore this great Python module and make the most out of the every function included in it.

Nikita Sobolev

Typeclasses in Python

In this post, I explain what typeclasses are (an alternative to subtyping polymorphism) and how to use them. I give examples in 4 very different languages to show that this concept is universal. I also show that this idea is very pythonic by comparing our classes implementation with functools.singledispatch.

Check how easy it is to define a typeclass with classes:

from classes import AssociatedType, Supports, typeclass

class Greet(AssociatedType):
    """Special type to represent that some instance can `greet`."""

def greet(instance) -> str:
    """No implementation needed."""

def _greet_str(instance: str) -> str:
    return 'Hello, {0}!'.format(instance)

def greet_and_print(instance: Supports[Greet]) -> None:

# Hello, world!

Check it out!


A from-scratch tour of bitcoin in Python

Andrej Karpathy, Sr. Director of AI at Tesla:

We are going to create, digitally sign, and broadcast a Bitcoin transaction in pure Python, from scratch, and with zero dependencies. In the process we’re going to learn quite a bit about how Bitcoin represents value. Let’s get it.

This post is a technical deep-dive. At the end he posted a reader exercise which was to steal some bitcoins his wallet. The challenge, of course, was completed within 45 minutes of publishing. 😁

Engineering at Meta Icon Engineering at Meta

A data augmentations library for audio, image, text, and video

AugLy is a great library to utilize for augmenting your data in model training, or to evaluate the robustness gaps of your model! We designed AugLy to include many specific data augmentations that users perform in real life on internet platforms like Facebook’s – for example making an image into a meme, overlaying text/emojis on images/videos, reposting a screenshot from social media. While AugLy contains more generic data augmentations as well, it will be particularly useful to you if you’re working on a problem like copy detection, hate speech detection, or copyright infringement where these “internet user” types of data augmentations are prelevant.

A data augmentations library for audio, image, text, and video

Practical AI Practical AI #138

Multi-GPU training is hard (without PyTorch Lightning)

William Falcon wants AI practitioners to spend more time on model development, and less time on engineering. PyTorch Lightning is a lightweight PyTorch wrapper for high-performance AI research that lets you train on multiple-GPUs, TPUs, CPUs and even in 16-bit precision without changing your code! In this episode, we dig deep into Lightning, how it works, and what it is enabling. William also discusses the Grid AI platform (built on top of PyTorch Lightning). This platform lets you seamlessly train 100s of Machine Learning models on the cloud from your laptop. Icon

How I teach Python on the Raspberry Pi 400 at the public library

Don Watkins:

Mark Van Doren said, “the art of teaching is the art of assisting discovery.” I saw that play out in this classroom using open source tools. More students need opportunities like this to help them gain a quality education. The Raspberry Pi 400 is a great form factor for teaching and learning.

Such a cool program that’d be easy to reproduce in your local library.

0:00 / 0:00