In this case, readability counts. Bringing backwards compatibility and readability altoghether, is the ideal world. As we can see, cjrh achieved that in a way. This cannot be the ideal yet, but there is a path to it. ;-)
In my opinion, this feature improve readability, among other things. Method signature is a good thing. Following The Zen of Python, "explicit is better than implicit". ;-) Congrats, cjrh. Massimo, I think it can be a good feature, mainly for beginners. But only if I don't need to implement my own request object. It would bring complexity and makes me worry about the technical solution, not about my problem (url mapping and params). -- Vinicius Assef. On Thu, Oct 28, 2010 at 6:39 AM, cjrh <[email protected]> wrote: > On Oct 28, 9:53 am, cjrh <[email protected]> wrote: > >> On Oct 27, 5:43 pm, VP <[email protected]> wrote: >> >> > @app.route('/insertdog/<name>/<age>/<owner>') >> > def insertdog(name,owner,age): >> > # other things >> >> For fun, I tried an experiment with decorators. Hold onto your >> seats: > > Naturally, this closer simulation of app.route syntax also works (but > I think the former separate arguments form works better): > > class R(object): > pass > request = R() > request.args=['caleb', 100] > > def validator(route): > args = route.split('/')[2:] > args = [i.replace('<', '').replace('>', '') for i in args] > assert(len(args)==len(request.args)) > def inner(f): > for name, value in zip(args, request.args): > setattr(f, name, value) > return f > return inner > > @validator('/controller_action/<first_name>/<age>') > def controller_action(): > return f.first_name, f.age > > print f() > > ================== > > OUTPUT: > > ('caleb', 100) >

