If it won't be simple, it simply won't be. [Hire me, source code] by Miki Tebeka, CEO, 353Solutions

Friday, January 26, 2007

Access SQL Query Results By Column Name

If work with sqlalchemy, you can access columns by their name and not just by their position (e.g. row.id instead of row[0]).

If you can't use sqlalchemy, you can still access columns by their names, at least on SQLite and PostgreSQL.

Wednesday, January 24, 2007

partial

Python 2.5 introduced the functools module and in it partial.

partial allow you to define a partial (doh!) application of a function to arguments. My common use (currently) is for re.sub
>>> from functools import partial
>>> import re
>>> remove_prefix = partial(re.compile("prefix: ").sub, "")
>>> remove_prefix("prefix: hello")
'hello'
>>> remove_prefix("hello")
'hello'
>>>

Wednesday, January 03, 2007

MochiKit and FireBug

Happy New Year!

Just a quick one ...

Doing a lot of AJAX lately. Found out that MochiKit and FireBug (there is even FireBug lite now) are excellent development tools. I made some very cool stuff with minimal learning curve.

More on this later.

Blog Archive