Archive for the 'Python' Category

Evolution of a Haskell Function

Thursday, March 11th, 2010

I’m going through Real World Haskell trying to get a handle on the Haskell programming language. Python is my current language of choice, but I like to learn new programming languages too.

So last night I was going over the chapter that introduces ‘let’, ‘where’, ‘case’ and guards and I wanted to try them out. I contrived a simple situation where I thought I could use them.

Link: PiCloud Overview

Thursday, March 11th, 2010

Here’s a great overview of using PiCloud that goes beyond “hello world” type stuff.
For those of you who don’t know, PiCloud is a cloud computing platform for Python that aims to simplify the task of running code in “the cloud.”
cw

Beautiful Coroutines

Tuesday, October 20th, 2009

Some guy on some other blog wrote this. His name sounds familiar …
Beautiful Coroutines: Cooperative Concurrency in Python using Diesel
cw

Diesel

Wednesday, September 23rd, 2009

I’ve been working with some friends on getting a startup off the ground. We just released one of the core libraries that our software is built on.
Announcing Diesel!
cw

Odd Old-Style vs. New-Style Class Behavior

Thursday, May 21st, 2009

So we have some older Python code at work that uses old-style classes. We usually try and bring those up to date when we encounter them.
The other day one of the developers did that and one of our tests started failing. A simple change from:

class Foo:
# stuff here

to:

class Foo(object):
[...]

Caching HTTP Responses with CherryPy

Wednesday, February 25th, 2009

The most basic case is very simple.

import time
import cherrypy
 
class WebSvc(object):
@cherrypy.tools.caching(delay=300)
@cherrypy.expose
def quadruple(self, number):
time.sleep(1) # make the real call somewhat costly
return str(int(number) * 4)
 
cherrypy.quickstart(WebSvc())

That uses an in-memory cache and [...]

HTTP Utilities with CherryPy

Thursday, January 8th, 2009

Eric Florenzano posted a detailed blog entry on creating fast web utilities with bare WSGI. In the blog he shared that the larger Python web frameworks are overkill for small utility-like applications. He then proceeded to build a small utility app that conforms to the WSGI spec.
I like to use CherryPy to write [...]

Useful Diagramming Web Application

Friday, October 17th, 2008

I stumbled across Web Sequence Diagrams the other day.
It’s a web-based diagramming application that uses a simple syntax to generate UML diagrams. No clicking around and positioning little boxes all over the place - just type in text that describes the diagram, and voila, there it is. He even provides a number of [...]

Customizing the Python Import System

Thursday, July 31st, 2008

So I’ve been programming with Python since 2001 and I’ve never had the need to do anything that the standard import system didn’t provide - until this week. We are planning on a little code reorganization for a project at work in preparation for collaboration from more developers. I wrote a simple custom [...]

Python’s Enhanced Generators

Friday, June 13th, 2008

So while I was mowing my grass last night, I got to thinking about Python 2.5’s enhanced generators and how I hadn’t tried them out yet. Here is a simple example that uses the consumer/pipeline model described in PEP 342.