Martin Pool's blog

The Year of Python

Troutgirl:

From the IM logs:

Joyce: Boy, this is definitely the Year of Python

Joyce: Last year, people said "Python might be OK for prototyping Java"

Joyce: This year, it's more like "Java is the new COBOL"

Murph: python has been, if you'll excuse the pun, creeping up on us for a while.

Murph: it's funny, because python has had some killer apps for a while, but they've been pretty invisible

Joyce: Like what?

Murph: things like Mailman

Joyce: Oh, that's Python?

Murph: see?

What's new in Python 2.4

What's New in Python 2.4:

(From LWN)

python - 70MB/s

I did a simple test the other night of how fast Python can read/write data. A simple 'cat' in Python can pump data through at about 70MB/s on a Pentium M laptop. This is just with simple read() and write() into strings, without any special tricks. By contrast bzip2 on that machine is only about 300kB/s.

That's probably pretty slow compared to C, but faster than most network connections could sustain. It's an interesting data point for writing moderate-performance software in Python.

(Doing a lot of manipulation might well slow it down.)

Beginners mistakes in Python

Hans Nowak wrote a good short article on beginners mistakes when moving to Python from some other language.

To preserve cosmic balance, Richard presents anti-pitfalls: mistakes that you can't make in Python that are possible in other languages.

nice Python Generators example

Todd links to a good example of generators in Python. You can do things like this in many languages with varying degrees of ease. In C you probably need to explicitly store all your state; in Scheme you probably need to explicitly get your head around continuations. Python is arguably the first mainstream language to add them as a first-class feature. It will be interesting to see how much people pick them up and use them. They're probably not something you want to use very often, but when you want them they're very handy.

The "level of elegance" in providing explicit generators is very typical of Python: you certainly could factor them into smaller components and write the rest as a library, but it's perhaps easier to use them in this packaging.

def genResults(db, sql):
   cursor=db.cursor()
   cursor.execute(sql)
   while 1:
      row=cursor.fetchone()
      if row is None: break
      yield row

Archives 2008: Apr Feb 2007: Jul May Feb Jan 2006: Dec Nov Oct Sep Aug Jul Jun Jan 2005: Sep Aug Jul Jun May Apr Mar Feb Jan 2004: Dec Nov Oct Sep Aug Jul Jun May Apr Mar Feb Jan 2003: Dec Nov Oct Sep Aug Jul Jun May