by fao_ · 9y ago · 0 comments
I think that were programming initially presented as such, this would not be a problem, but I expect that many developers are so finely attuned and specialized to text that other methods will not take off purely because of the learning curve.
Our tools on the other hand are indeed 'so finely attuned and specialised to text' that other methods of representation have and will struggle to get traction...
SUPERTYPES = {'Real': ['Integer'],
'Complex': ['Real'],
'Integer': []}
def is_subtype(a, b):
if a == b:
return True
return any(is_subtype(x, b) for x in SUPERTYPES[a])
Which better expresses the intention of the code and is more flexible.