Infrequently Noted

Alex Russell on browsers, standards, and the process of progress.

Comments for Upgrade


Hey Kevin,

You're right, of course. Although I will say that I dislike both annotation and decorators. Of the two, I do prefer Python's approach, but both are a bit too "magical" for my tastes.

Thanks for catching my error.

Regards

by alex at
lxml does indeed look pretty cool. Python 2.5 includes ElementTree, which means that lxml will be an easy step up for people who need full XPath and XSLT.

One thing worth correcting: Python doesn't have annotations in the sense that Java has annotations. Python has "decorators", and the difference is quite significant.

(This code is likely to get mangled, but hopefully the point will still get through):

@expose() def foo(self): return "Bar"

may look like it's annotating foo as being available for the web (in TurboGears/CherryPy). But, it is in fact exactly equivalent to:

def foo(self): return "Bar" foo = expose()(foo)

A decorator doesn't just add metadata. It can completely replace the original function. It's a powerful and relatively easy way to deal with cross-cutting concerns.

Hi Alex,

Everyone's tastes do vary... I actually find decorators to be no more magical than inheritance. It's just a different construct and a different way to encapsulate code. Consider this example to see where it's valuable:

def foo(self): trans = start_transaction() try: ...do stuff... trans.commit() except: trans.rollback() trans.end()

That gets old pretty quickly. One way around it is this:

def foo(self): def dostuff(): ...do stuff... run_with_transaction(dostuff)

(of course, you'd be able to use an anonymous block for this in a language that supports that :)

But, to me, the decorator style is quite nice:

@use_transaction() def foo(self): ...do stuff...

Django is pretty A for a lot of web stuff but I guess you already knew that.

I have never been completely happy about database access in Python. I could live with SQLobject and Django's models are kind of nice but it was always missing some oomph. Recently I have been hearing all kind of nice things about SQLalchemy(.org) which indeed looks very promising.

by Alper at
I would also have suggested TurboGears, following my natural biases, but I know the kind of stuff that Alex works on and Twisted is likely the best choice for that.

SQLAlchemy is indeed quite impressive and is destined to be the standard in TurboGears. Most relevant to Alex, it's worth noting that some work has been done to integrate SQLAlchemy with Twisted.

If you're interested in generic functions, PJE has an implementation (RuleDispatch) that's slowly diffusing into a number of other projects.
by Karl G at
Sounds like a fun project :-)
by Abe at
Hi, Alex,

I'm the founder of ajaxcn.org, a Chinese Ajax website. There are many developers in China who are interested in in dojo toolkit. So we want to translate the dojo documents into Chinese.

The documents we want to translate includes: http://dojotoolkit.org/docs/ http://manual.dojotoolkit.org/

Would you mind us to translate these documents into Chinese?

Best Regards dlee.cn@gmail.com

Hey David,

We'd love your help with the docs and with internationalizing/localizing the toolkit's built-in strings. Send me private mail so I can get you on the dojo contributors mailing list.

Regards

by alex at
Hi, alex, I sent an email to this mailbox: alex@dojotoolkit.org, please check your email.

Best Regards