Apr
6th
Mon
6th
Modern Static Typing: Less Code, Better Code
“Consider:
class Artist:
def draw(self):
print "Sketch!"
class Gunslinger:
def draw(self):
print "Bang!"
for obj in [Artist(), Gunslinger()]:
obj.draw()
Artist.draw and Gunslinger.draw are clearly not even conceptually related, and our Artist has wandered unwittingly into a gunfight. I considered this problem to be fairly unimportant from a practical standpoint, because it usually doesn’t happen very often.”