class ThreeVec: "Class for 3 Vector and operations" def Add( self, tv ): # add two 3 vecs "Add two ThreeVecs" newvec = ThreeVec( self.x+tv.x, self.y+tv.y, self.z+tv.z) return newvec #
Help on class ThreeVec in module ThreeVec: class ThreeVec | Class for 3 Vector and operations | | Methods defined here: | | Add(self, tv) | | Length(self) | | SkalProd(self, tv) | | __add__(self, tv) | method for overloading the + operator | | __cmp__(self, tv) | | __init__(self, x=0.0, y=0.0, z=0.0) | | __str__(self) ...
['Add', 'Length', 'SkalProd', '__add__', '__cmp__', '__doc__', '__init__', '__module__', '__str__']
['Add', 'Length', 'SkalProd', '__add__', '__cmp__', '__doc__', '__init__', '__module__', '__str__', 'x', 'y', 'z']
>>> a=5.2 >>> b=[1,6,"abc"] >>> c="Hello" >>> type(a) <type 'float'> >>> type(b) <type 'list'> >>> type(c) <type 'str'> >>> type(v) <type 'instance'> >>> c.__class__.__name__ 'str' >>> b.__class__.__name__ 'list' >>> v.__class__.__name__ 'ThreeVec'