Contribute Media
A thank you to everyone who makes this possible: Read More

Solving the web most popular code shortening competition with Python 3


“Code shortening” is the “sport” where participants strive to achieve the shortest possible source code that solves a programming problem by exploiting all the tricks and quirks of the language.

The SIZECON problem on SPOJ is one of the oldest and most popular code shortening problems on the web with a bizarre twist, only character above ASCII value 32 are counted for the penalty. During the talk we will take a journey into some frightening depths of the Python language in order to write shorter and shorter solutions to SIZECON until, exploiting a number of mind-blowing tricks, we will reach the current record solution for Python 3 of 31 characters.

I promise I’ll show you the most obfuscated, contrived and sick python code you have ever seen and (hopefully!) will ever see. I invite participants to give SIZECON a try and check their score against the Python3 rankings.

This is an updated version of a talk I presented during Europython 2015 and that had an unexpected success both on-site and on social media. The talk is now centred on Python 3 shorting tricks and is has been reworked to be much more easy to follow.


Improve this page