# Python 'Sets' in Ignition

**URL:** <https://forum.inductiveautomation.com/t/python-sets-in-ignition/39283>\
**Category:** Ignition\
**Tags:** python\
**Created:** [October 1, 2020, 8:21pm UTC](https://forum.inductiveautomation.com/t/python-sets-in-ignition/39283 "2020-10-01T20:21:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris.Hawkey](https://avatars.discourse-cdn.com/v4/letter/c/77aa72/32.png) [@Chris.Hawkey](https://forum.inductiveautomation.com/u/Chris.Hawkey)\
**Post date:** [October 1, 2020, 8:21pm UTC](https://forum.inductiveautomation.com/t/python-sets-in-ignition/39283/1 "2020-10-01T20:21:02Z")

</div>

Hello,

I am attempting to verify that a system.tag.writeBlocking function successfully wrote to every tag in the list.  
It works on one of my scripts that was writing to 50+ tags, but i wrote a similiar script (with only 3 tag writes) and when I cast the results of the writeBlocking function into a python set (which should only populate with unique values), I am getting a length of 2 (length should be equal to 1 if all quality code results == ‘Good’ )

Identical code in both scripts:

```auto
writeResult = system.tag.writeBlocking(tagPaths,tagVals,5000)
print writeResult
print set(writeResult)

```

Print results of the two functions below:

```auto
[Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good, Good]
set([Good])
containerClear() successful: 239
-------
[Good, Good, Good]
set([Good, Good])
workcenterSet(45830) failed: 78

```

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 1, 2020, 8:29pm UTC](https://forum.inductiveautomation.com/t/python-sets-in-ignition/39283/2 "2020-10-01T20:29:10Z")

</div>

`QualityCode` doesn’t implement `hashCode()` so I wouldn’t expect it to play well with sets.

---

<div class="post-metadata">

**Author:** ![Chris.Hawkey](https://avatars.discourse-cdn.com/v4/letter/c/77aa72/32.png) [@Chris.Hawkey](https://forum.inductiveautomation.com/u/Chris.Hawkey)\
**Post date:** [October 1, 2020, 8:31pm UTC](https://forum.inductiveautomation.com/t/python-sets-in-ignition/39283/3 "2020-10-01T20:31:41Z")

</div>

Would a possible solution be to cast the list as a list of strings first?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 1, 2020, 8:34pm UTC](https://forum.inductiveautomation.com/t/python-sets-in-ignition/39283/4 "2020-10-01T20:34:03Z")

</div>

How about this:

```auto
allGood = all(result.isGood() for result in writeResult)

```

---

<div class="post-metadata">

**Author:** ![Chris.Hawkey](https://avatars.discourse-cdn.com/v4/letter/c/77aa72/32.png) [@Chris.Hawkey](https://forum.inductiveautomation.com/u/Chris.Hawkey)\
**Post date:** [October 1, 2020, 8:38pm UTC](https://forum.inductiveautomation.com/t/python-sets-in-ignition/39283/5 "2020-10-01T20:38:45Z")

</div>

That works wonderfully, that way i wouldn’t have to worry about casting the list as a string.  
Thanks Kevin
