A blog about my experiences with bioinformatics, operating systems, and random other technologies and bits.

Wednesday, July 23, 2008

Equality of elements should imply equality of types

Unfortunately, few things are perfect. I'll leave it to someone else to tell me I'm wrong (or right?) here, but the following seems less than ideal:

sage: a = int('1')
sage: b = Integer('1')
sage: a == b
sage: type(a) == type(b)

I love Sage, so maybe I'll come back to this later when I have more time. Right now, I think that if type(a) is contained in type(b) *and* a == b, then type(a) == type(b) should return true. But this brings up interesting questions about what are types ... I'll edit this entry more later once I've read up on more type theory, more category theory, and sage/python type handling design (this could be a while!).