Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Private Member Functions | Static Private Attributes
test.test_richcmp.Vector Class Reference

List of all members.

Public Member Functions

def __init__
def __len__
def __getitem__
def __setitem__
def __bool__
def __cmp__
def __repr__
def __lt__
def __le__
def __eq__
def __ne__
def __gt__
def __ge__

Public Attributes

 data

Private Member Functions

def __cast

Static Private Attributes

 __hash__ = None

Detailed Description

Definition at line 37 of file test_richcmp.py.


Constructor & Destructor Documentation

def test.test_richcmp.Vector.__init__ (   self,
  data 
)

Definition at line 39 of file test_richcmp.py.

00039 
00040     def __init__(self, data):
00041         self.data = data

Here is the caller graph for this function:


Member Function Documentation

Definition at line 53 of file test_richcmp.py.

00053 
00054     def __bool__(self):
00055         raise TypeError("Vectors cannot be used in Boolean contexts")

def test.test_richcmp.Vector.__cast (   self,
  other 
) [private]

Definition at line 80 of file test_richcmp.py.

00080 
00081     def __cast(self, other):
00082         if isinstance(other, Vector):
00083             other = other.data
00084         if len(self.data) != len(other):
00085             raise ValueError("Cannot compare vectors of different length")
00086         return other

Here is the caller graph for this function:

def test.test_richcmp.Vector.__cmp__ (   self,
  other 
)

Definition at line 56 of file test_richcmp.py.

00056 
00057     def __cmp__(self, other):
00058         raise support.TestFailed("Vector.__cmp__() should not be called")

def test.test_richcmp.Vector.__eq__ (   self,
  other 
)

Definition at line 68 of file test_richcmp.py.

00068 
00069     def __eq__(self, other):
00070         return Vector([a == b for a, b in zip(self.data, self.__cast(other))])

Here is the call graph for this function:

def test.test_richcmp.Vector.__ge__ (   self,
  other 
)

Definition at line 77 of file test_richcmp.py.

00077 
00078     def __ge__(self, other):
00079         return Vector([a >= b for a, b in zip(self.data, self.__cast(other))])

Here is the call graph for this function:

def test.test_richcmp.Vector.__getitem__ (   self,
  i 
)

Definition at line 45 of file test_richcmp.py.

00045 
00046     def __getitem__(self, i):
00047         return self.data[i]

def test.test_richcmp.Vector.__gt__ (   self,
  other 
)

Definition at line 74 of file test_richcmp.py.

00074 
00075     def __gt__(self, other):
00076         return Vector([a > b for a, b in zip(self.data, self.__cast(other))])

Here is the call graph for this function:

def test.test_richcmp.Vector.__le__ (   self,
  other 
)

Definition at line 65 of file test_richcmp.py.

00065 
00066     def __le__(self, other):
00067         return Vector([a <= b for a, b in zip(self.data, self.__cast(other))])

Here is the call graph for this function:

Definition at line 42 of file test_richcmp.py.

00042 
00043     def __len__(self):
00044         return len(self.data)

def test.test_richcmp.Vector.__lt__ (   self,
  other 
)

Definition at line 62 of file test_richcmp.py.

00062 
00063     def __lt__(self, other):
00064         return Vector([a < b for a, b in zip(self.data, self.__cast(other))])

Here is the call graph for this function:

def test.test_richcmp.Vector.__ne__ (   self,
  other 
)

Definition at line 71 of file test_richcmp.py.

00071 
00072     def __ne__(self, other):
00073         return Vector([a != b for a, b in zip(self.data, self.__cast(other))])

Here is the call graph for this function:

Definition at line 59 of file test_richcmp.py.

00059 
00060     def __repr__(self):
00061         return "Vector(%r)" % (self.data, )

def test.test_richcmp.Vector.__setitem__ (   self,
  i,
  v 
)

Definition at line 48 of file test_richcmp.py.

00048 
00049     def __setitem__(self, i, v):
00050         self.data[i] = v


Member Data Documentation

test.test_richcmp.Vector.__hash__ = None [static, private]

Definition at line 51 of file test_richcmp.py.

Definition at line 40 of file test_richcmp.py.


The documentation for this class was generated from the following file: