"Safe" names for developer-defined object members

This is an excellent question. We’re actually about to deprecate the “feature” that you can add arbitrary attributes to component objects, for precisely the reason you mention - people often accidentally create conflicts, or fail to notice typos.

We will move to an implementation where every component has a ‘tag’ attribute, which will be an object on which you can set any attributes you wish. You will also be able to replace it completely. For example:

b = Button()
b.tag = "Here is some arbitrary data"

or

b = Button()
b.tag.foo = "Some data"
b.tag.bar = "Some more data"

Of course we will make this change gradually, so existing apps won’t break, but if you want to minimise changes you might have to make, you should use the ‘tag’ attribute as in the first example above.

Hope that helps. Let me know if it makes sense!

3 Likes