Sunday, August 09, 2009

A quick thought ... working with a lot of Django and Pinax at the moment, I'm seeing a lot of use of Python's varargs. Functions that just take *argv, **kwargs

I find I don't like this. I want to see argument lists as explicit as possible. I feel uncomfortable and a bit lost. I feel unprotected when the compiler can't even check the number of arguments I'm sending.

So I wonder if this is legitimate. Or isn't it analogous to the case of static typing? Varargs give more flexibility than fixed arguments. Much as dynamic typing is more flexible than static. So why shouldn't I prefer the power and flexibility over restriction and security in this case?

Update : Of course, this is the way that GeekWeaver works, where there's no explicit definition of the list of arguments passed to a reusable block. I've been unhappy with that there too. Thinking that I should add positional explicit named arguement lists. But if this kwargs thing is a trend, then GW should probably be left as it is.

No comments: