Entries tagged as python

Could we run Python 2 and Python 3 code in the same VM with no code changes?

March 25, 2018, 11:43 p.m. Entry tagged as and python.

Theoretically, yes. Zed Shaw famously jested that if this is impossible then Python 3 must not be Turing-complete. But in practice, this is unrealistic and I'll share why by giving you a few examples.

RE: Diversity on the Python sprint in September

Oct. 4, 2016, 7:19 p.m., last updated Oct. 4, 2016, 8:25 p.m. Entry tagged as diversity and python.

As an organizer, I feel compelled to respond to the accusations about this event not being diverse enough.

What single-dispatch generic functions mean for you

June 5, 2013, 11:50 a.m., last updated Jan. 23, 2019, 6:06 p.m. Entry tagged as long , PEP and python.

PEP 443 has just been accepted. It brings a uniform API for creating and managing single-dispatch generic functions in Python 3.4. If the last sentence read to you like some Haskellish solution to a self-inflicted problem, this post is here to explain how generic functions may help you to organise real world code.

Error opening file for reading: Permission denied

Aug. 16, 2012, 3:38 p.m., last updated Dec. 4, 2012, 5:51 p.m. Entry tagged as bug , libjpeg , pil , python and ubuntu.

As we released Ralph as an open source project, new users started deploying it and very soon ran into an annoying problem. The output of each ralph command was preceeded with a meaningless message out of nowhere:

Error opening file for reading: Permission denied

Took me a while to identify the culprit and work around this.

Upgrading the choices machinery for Django

April 3, 2012, 9:01 p.m. Entry tagged as django and python.

Specifying choices for form fields and models currently does not do much justice to the DRY philosophy Django is famous for. Everybody seems to either have their own way of working around it or live with the suboptimal tuple-based pairs. This Django enhancement proposal presents a comprehensive solution based on an existing implementation, explaining reasons behind API decisions and their implications on the framework in general.

The Zen of Python and Me

March 31, 2012, 10:07 p.m., last updated April 14, 2012, 2:17 a.m. Entry tagged as long , python and zen.

import this is a brilliant easter egg in the Python interpreter. In just a few words it catches the philosophy behind what is considered "pythonic". One might argue that it describes the essence of what is so great about the language, its libraries and its community.

But for it to be more than just a bunch of aphorisms, a programmer has to ask herself: how do I conform to those guidelines in my daily work? I asked myself this question the other day and here are a few thoughts and opinions. Beware that this is at times very meta.