标签:elf sel 表达 show 自动 pytho init add python
class V3: def_init_(self,x = 0,y = 0,z = 0): self.X = x self.Y = y self.Z = z def_add_(self,n): r = V3() r.X = self.X+n.X r.Y = self.Y+n.Y r.Z = self.Z+n.Z return r def_sub_(self,n): r = V3() r.X = self.X+(-n.X) r.Y = self.Y+(-n.Y) r.Z = self.Z+(-n.Z) return r def_mul_(self,n): r = V3() r.X = self.X*n r.Y = self.Y*n r.Z = self.Z*n return r def_truediv_(self,n): r = V3() r.X = self.X/n r.Y = self.Y/n r.Z = self.Z/n return r def_floordiv_(self,n): r = V3() r.X = self.X//n r.Y = self.Y//n r.Z = self.Z//n return r def show(self): print(self.X,self.Y,self.Z))
标签:elf sel 表达 show 自动 pytho init add python
原文地址:https://www.cnblogs.com/Glzt/p/12837739.html