python的专用类方法
摘要:
#!/usr/bin/pythonimport mathclass Vector: def __init__(self, a, b): self.a = a self.b = b def __str__(self): return 'Vector (%d, %d)' % (self.a, self.b) def __add__(self,other): return Vector(self.a + other.a, self.b + other.b) def __abs__(self): return math.... 阅读全文
posted @ 2013-01-03 11:23 mymemory 阅读(120) 评论(0) 推荐(0)
浙公网安备 33010602011771号