Python usergroup the Netherlands (PUN) meeting in Veenendaal

Tags: pun, python

I myself gave a talk on practical project automation, the summary of that is in the linked separate post.

Pythonic observable

Erik Groeneveld (Seek You Too) gave a talk at the PUN meeting in Veenendaal.

The observer pattern. An object is an observable and several other objects are observers that observe that observable. Main reason: you have some relation between objects, but you don’t want to make the relation explicit or hardcoded as the observed object doesn’t care who looks at it.

Erik started with an empty python file and slowly added classes and methods to build some quick event system, showing that it quickly gets elaborate and inflexible. He searched for a simple pythonic way, but couldn’t find an observers/observables/event framework.

Jan-Wijbrand Kolman rightfully mentioned zope.event that ought to do everything you want of an event framework. Zope.event nicely decouples the observer and observable.

What Erik (and some others) made is some observable base class with an addObserver() method. And it has self.any(), self.all() etc. methods that call any or all registered observers with some method and yield the results as a generator. The library in which he distilled this all is part of http://weightless.io .

Lightning talks

  • Pygame by Quintijn Hoogenboom. As a personal hobby project, he wrote a sudoku puzzle solver. Nice that it works, but he wanted to show the results to family. In came pygame. Pygame makes it easy to create a playing field, some pieces and steer some movement, all with handy methods to handle it. Recommended. And fun to play with.
  • Mercurial by Marijn Vriens. Mercurial is a distributed version control systems. Subversion is a centralized version control system: everything is handled and stored on one central server. Mercurial is distributed: every copy of the repository is, well, a repository. Whether on a server or on your local machine. Every command works locally. You work locally. Merging, committing, diffing, etc. Only when you explicitly push/pull from an external location is there something that goes over the network. Centralized systems make branches easier, distributed systems make merging easier. And everyone is a developer. No more have and have-not developers. Your local copy is a real copy. Pushing changes or including changes is a conscious choice. And if there is a central repository: it is only a central repository as people made a decision to treat it as a central one. Only those people with access right to that central repository can push changes there. But all people have all the tools they need to develop with the code and to make changes and to make them available.
  • Reaper: demo of audio editing tool reaper. Reaper saves its project files as plain text. And plain text is excellent python fodder. So he did a bit of python scripting and managed to save a lot of time: python creating a file instead of manually dragging/duplicating/modifying a couple of hundred sound samples. Hurray for python.
blog comments powered by Disqus
 
vanrees.org logo

About me

My name is Reinout van Rees and I work a lot with Python (programming language) and Django (website framework). I live in The Netherlands and I'm happily married to Annie van Rees-Kooiman.

Weblog feeds

Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):