Hi Dimitri,
I was also surprised your original code did not work. It does work if you use a list instead of a set:
ACCEPT = [...]
After scratching my head for a minute, I believe this is because the "contains" operation of a set will not call __eq__. Since sets contain unique values, they probably simply check for a hash of the value in the set, like what is used with dictionary keys, rather than comparing the values themselves, which makes for much faster operations. In fact I'm pretry sure I have read this somewhere before.
I suppose there is a way to modify pydicom's UID class to add a __hash__ function, but it hurts my brain a little to think through the consequences of that. In fact I think we could not reliably get both comparisons (by name and by dotted number) to work.
And ... don't worry about the "noise" ... these were interesting questions that did point out a weakness we didn't know existed.
Darcy