Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Private Member Functions
nasty_eq_vs_dict.Yuck Class Reference

List of all members.

Public Member Functions

def __init__
def make_dangerous
def __hash__
def __eq__

Public Attributes

 i

Private Member Functions

def __fill_dict

Detailed Description

Definition at line 9 of file nasty_eq_vs_dict.py.


Constructor & Destructor Documentation

Definition at line 10 of file nasty_eq_vs_dict.py.

00010 
00011     def __init__(self):
00012         self.i = 0

Here is the caller graph for this function:


Member Function Documentation

def nasty_eq_vs_dict.Yuck.__eq__ (   self,
  other 
)

Definition at line 20 of file nasty_eq_vs_dict.py.

00020 
00021     def __eq__(self, other):
00022         if self.i == 0:
00023             # leave dict alone
00024             pass
00025         elif self.i == 1:
00026             # fiddle to 16 slots
00027             self.__fill_dict(6)
00028             self.i = 2
00029         else:
00030             # fiddle to 8 slots
00031             self.__fill_dict(4)
00032             self.i = 1
00033 
00034         return 1

Here is the call graph for this function:

def nasty_eq_vs_dict.Yuck.__fill_dict (   self,
  n 
) [private]

Definition at line 35 of file nasty_eq_vs_dict.py.

00035 
00036     def __fill_dict(self, n):
00037         self.i = 0
00038         dict.clear()
00039         for i in range(n):
00040             dict[i] = i
00041         dict[self] = "OK!"

Here is the caller graph for this function:

Definition at line 16 of file nasty_eq_vs_dict.py.

00016 
00017     def __hash__(self):
00018         # direct to slot 4 in table of size 8; slot 12 when size 16
00019         return 4 + 8

Definition at line 13 of file nasty_eq_vs_dict.py.

00013 
00014     def make_dangerous(self):
00015         self.i = 1


Member Data Documentation

Definition at line 11 of file nasty_eq_vs_dict.py.


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