Check two variants for strict equality of type and value.
(s1, s2)
| 162 | |
| 163 | |
| 164 | def vtkVariantStrictEquality(s1, s2): |
| 165 | """ |
| 166 | Check two variants for strict equality of type and value. |
| 167 | """ |
| 168 | s1 = vtkCommonCore.vtkVariant(s1) |
| 169 | s2 = vtkCommonCore.vtkVariant(s2) |
| 170 | |
| 171 | t1 = s1.GetType() |
| 172 | t2 = s2.GetType() |
| 173 | |
| 174 | # check based on type |
| 175 | if t1 != t2: |
| 176 | return False |
| 177 | |
| 178 | v1 = s1.IsValid() |
| 179 | v2 = s2.IsValid() |
| 180 | |
| 181 | # check based on validity |
| 182 | if (not v1) and (not v2): |
| 183 | return True |
| 184 | elif v1 != v2: |
| 185 | return False |
| 186 | |
| 187 | # extract and compare the values |
| 188 | r1 = getattr(s1, _variant_method_map[t1])() |
| 189 | r2 = getattr(s2, _variant_method_map[t2])() |
| 190 | |
| 191 | return (r1 == r2) |
| 192 | |
| 193 | |
| 194 | def vtkVariantLessThan(s1, s2): |