I'm playing around with a simple port of the Protovis API to Python.
Consider the simple bar chart example, in Javascript:
var vis = new pv.Panel()
.width(150)
.height(150);
vis.add(pv.Bar)
.data([1, 1.2, 1.7, 1.5, .7, .3])
.width(20)
.height(function(d) d * 80)
.bottom(0)
.left(function() this.index * 25);
vis.render();
I'm debating whether to continue to use this fluent interface style API or use named parameters instead. With named parameters we could write:
vis = pv.Panel(width=150,
height=150)
vis = vis + pv.Bar(data=[1, 1.2],
width=20,
height=lambda d: d * 80,
bottom=0,
left=lambda: self.index * 25)
vis.render()
Is there a preferred Python style?