class BinaryUnderscorifier(object):

    def __getattr__(self, name):
        return int(name.replace('_', ''), 2)
b = BinaryUnderscorifier()
print(b._1100_0111_0001 == 3185)
How to add a reader macro to Python?