Dan Callaghan

Kiwi PyCon 2015

Earlier this month I was fortunate enough to travel to Christchurch for a weekend to attend Kiwi PyCon 2015. Below are my impressions from the talks I attended.

I also really enjoyed the architecture at the conference venue, the University of Canterbury. I posted a few photos from around the campus on my Flickr account.

Katie Bell: How Python works as a teaching language

Katie works at Grok Learning and has lots of experience teaching children to program in Python. For those of us who have been writing code for a long time, it can be difficult to put ourselves back in the shoes of a beginner, but it’s an important thing to consider. Katie did a good job of describing the ways beginners can be caught out when learning Python.

She dedicated a decent chunk of her talk to calling out IDLE’s inadequacies, which echoed the same frustrations that Carrie Anne Philbin brought up in her PyCon Australia keynote. It seems like there is a serious need for a decent beginner’s Python editor. (Basically a local version of the Grok Learning interface?) It seems like the momentum is building and we will hopefully see a better IDLE replacement coming out of the community soon.

Thomi Richards: Connascence in Python

Thomi talked about the idea of connascence, which gives us a way of categorising different kinds of coupling in a program’s source code. He has produced a neat little web site defining the different categories of connascence along with some helpful examples.

The most interesting thing for me was recognising that a lot of the “code smells” that we learn from experience to avoid are some of the stronger types of connascence. And the refactoring that we intuitively want to apply in order to clean up the smell is actually trading a stronger type of connascence for a weaker one.

A nice example from Thomi’s talk, using integers to encode user roles:

def get_user_role(username):
    user = database.get_user_object_for_username(username)
    if user.is_admin:
        return 2
    elif user.is_manager:
        return 1
    else:
        return 0
...
if get_user_role(username) != 2:
    raise PermissionDenied("You must be an administrator")
...

The obvious refactoring here is to extract the integer values to named constants or symbolic values. In doing so, we are trading connascence of meaning (the code must agree on the meaning of the value 2) for the weaker connascence of name (the code need only refer to the same named constant).

Benoit Chabord: Python and Elasticsearch

Benoit talked about Elasticsearch, and how GrabOne was able to gradually integrate it into an existing PHP and Python code base, and improve their user experience in the process.

Robert Collins: Functionalish programming in Python

Pip, like many real world programs, is deeply network-bound and so unit testing it in isolation is difficult. One technique is to use the Effect library to write pure functions which manipulate Effect objects representing stateful operations, and Performers which execute the operations. In tests the Performers are replaced with dummy implementations so that the pure logic can be tested without side effects.

An interesting take, in that the end result feels much more Pythonic than other attempts at implementing monads in Python.

Ducky: An introduction to Wagtail

Wagtail is a content management system written in Python, with some shiny UI that apparently makes it better than some other similar projects.

Lee Begg: My own PaaS in Python

Not really a PaaS so much as a collection of tools which the speaker uses for deploying Python web apps in a modern, efficient way: Circus for service management, Chausette as WSGI server, and Fabric for deployment automation. The setup Lee describes is more like halfway between the traditional deployment by hand and a modern PaaS.

Ben Shaw: Microservices, is HTTP the only way?

Apparently as a hypothetical experiment, Ben tried replacing the HTTP communications in a microservices-style application with a message queue, and then later plain TCP and UDP sockets, with mixed results. Unfortunately he hadn’t heard of Zeromq which might have made things easier.

The final conclusion seems to be that HTTP is just fine?

Allison Kaptur: Effective learning for programmers

A fascinating overview of the psychology around people’s belief about intelligence and whether it is an inherently fixed trait (“fixed mindset”) or can be grown over time with effort (“growth mindset”).

Allison described a number of surprising results from studies showing the benefits of having a “growth mindset”, and suggested ways to foster that in ourselves and others.

Cory Benfield: You don’t care about efficiency

The speaker admitted that his title and abstract were clickbait (or I guess, whatever the conference talk equivalent to clickbait is?) and

Fei Long Wang: Zaqar

I got very little from this talk. It might be my lack of familiarity with the whole OpenStack ecosystem.

Tim Mitchell: Database migrations using Alembic

Tim talked about how powerful Alembic is, and how important it is to have automatic database schema migrations. For someone unfamiliar with Alembic this might have been eye-opening, but we went down the same path more than a year ago on our project at work so there was nothing new for me (and indeed, I could probably show Tim a thing or two about testing Alembic migrations).

Brian Thorne: Blind analytics

Brian gave an overview of some cryptographic techniques for performing computation (like data mining) without having full access to the underlying data set. The idea is to use sensitive or private data (like health records) for data mining, without compromising the privacy of the data involved.

After hearing Carina C Zona’s PyCon Australia keynote about the human consequences of data mining, this topic seemed particularly pertitent.

Originally published . Tagged: , .