How do I set multiple attributes? If I have multiple attributes that I want to set to an element in a twig template it can get quite long since each attribute requires setAttribute(attribute name, attribute value).

Based on my IRC conversation (I don't remember who it was), it looks like it is not possible to set multiple attributes at once, like it is possible with CSS classes.

So I would like to know what would be a "pretty" way of setting multiple attributes in a twig template. I presume a loop of some kind.
If you are adding the attributes in Twig you can set multiple attributes by chaining the setAttribute calls like this:

{{ attributes.setAttribute('id', 'value').setAttribute('data-info', 'value'); }}