Talk

Nim for Pythonistas

Friday, May 24

14:45 - 15:15
RoomSpaghetti
LanguageEnglish
Audience levelIntermediate
Elevator pitch

What if I could tell you that there is a language that looks like Python but achieves the performance of C? And that also has the power of metaprogramming of Lisp? Nim is a statically typed compiled language that does all the above and more. And it is easy to learn for Pythonistas.

Abstract

Experienced Pythonistas are used to reach out to an alternative language when in need for higher performance. In the past this meant to reach out for C, C++ or Cython, more recently the trend is towards Rust. Nim is a relatively unexplored option as a language to learn as a second (or third or …) language on top of Python, but it does provide some interesting benefits. As Rust, Nim is a statically typed and compiled programming language that can be use to boost Python’s performance. But Nim has different tradeoffs, in particular less emphasis on memory safety and a much easier learning curve, thanks to a indentation based syntax very much familiar to Python developers.

In this talk we will give a brief presentation of Nim language particularly tailored to Pythonistas. We will cover the language from the ground up, making frequent remarks to the differences with Python. We will briefly cover metaprogramming, one of the most powerful parts of Nim. We will try to convert the philosophy of the language (the Zen of Nim) and we will also cover the part of the ecosystem that are relevant for interoperability with Python (nimpy, nimporter, …). We will also cover one of the most interesting aspects of Nim that represents a rather distinctive selling point: Nim can compile to Javascript and allows us to be able to work with frontend technologies directly.

At the end we will briefly cover Nimib, my open source project recently ported also to Python. This will showcase a way to use metaprogramming in a real project and how to create a Python package using Nim.

The goal of this talk is to make you curious to go and try out Nim (come for the performance, stay for the ergonomics!), but even if you just come out with a better appreciation and understanding of Python we would still be happy.

TagsPerformance, JavaScript
Participant

Pietro Peterlongo

After 9 years as Data Scientist/Software engineer in Toolsgroup, a company that makes a software for Supply Chain Planning and Optimization, I am taking some time off and working to become a better programmer at Recurse Center. At the time that this conference is happening hopefully I should have a new job… we will see!

I am passionate about Open Source and Tech communities (Python community is the best one :hearth:!), I help organize Python Milano meetup and recently started PyData Milano meetup. I love programming languages, Python is of course my first love, but you might want to ask me about Nim, which I think is a great second language to learn after Python. I have also been studying functional programming languages which I think they are pretty cool (ask me about Elm and Gleam), and yeah, maybe by the time I am at the conference I will have stopped procrastinating learning Rust…