I try to check if a certain pair has any kerning. I am aware of the difference of group and non-group kerning, but for simplicity I just use this sketch here:

font = Glyphs.font
kV = font.kerningForPair(font.selectedFontMaster.id, 'T', 'A')
print kV
if kV == 9.22337203685e+18:
print "No Kerning"

Unfortunately the conditional case does not work like this. According to the documentation this is the float value for 0. I tried to work with int(kV) == 9223372036854775808 of that number as well, but this seems to be not bullet proof?! How can one check if a pair (nevermind the group kerning for now) has no kerning?

BTW: the documentation says:

9.22337203685e+18 # (this is the float value for 0, an integer transformation would actually return 0)

Hmm. Seems to be an inconsistency in the PyObjC Bridge. You can divide both values by 18.0 or check for >= instead of ==.

Just found that the value returned is 9223372036854775808, so one more than 9223372036854775807 (=NSNotFound). Now I am confused myself, perhaps it has to do with conversion from signed or unsigned integer to long. In any event, you can convert a number to a long by hanging .__long__() at the end.

The problem is with how floats are stored. If you do a few calculations like

1.23425 * 0.234 / 0.234 != 1.23425

I don’t know if they fixed it but I had that white often that you would set the size of something in Illustrator to some value (e.g. 5.6) and it would always display as 5.599999999.
Here is a easy and a lengthy explanation.

And if you add the pyobjc bride to the mix, you get even bigger differences.

So to check if two floats are the same I usually do this: