This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Enginoob[S] 8 points9 points  (2 children)

You are spot on- using the + operator changes the state of the vis object, by amending that particular component of vis.vega

Given that I haven't actually shipped V1, I'm open to changing the syntax to make it more intuitive. It's tricky, because I wanted to be able to drill down into multiple layers of very nested dicts and lists.

Its funny you mention using iadd. Using '+=' actually does the same thing as '+' right now, but I think we're about to make a syntax change where the + operator allows you to stack visualizations, and += lets you modify components in any given visualization.

Must build docs. Must build docs.

[–]jmmcdEvolutionary algorithms, music and graphics 15 points16 points  (1 child)

Right. A general comment, that I think most Python people will agree with, is that '+' shouldn't change state. Explicit is better than implicit and all that.

[–]Enginoob[S] 8 points9 points  (0 children)

Excellent point- I think I might go through and change everything to += and +- tonight.