Project

General

Profile

1 2359 aaronmk
# Objects
2
3 2362 aaronmk
import util
4
5 2359 aaronmk
class BasicObject:
6
    '''Provides default implementations of commonly-used methods'''
7
8
    def __str__(self): return util.class_name(self)+repr(self.__dict__)
9
10
    def __repr__(self): return str(self)
11 2362 aaronmk
12
    def __eq__(self, other):
13
        return (other != None and other.__class__ == self.__class__
14
            and other.__dict__ == self.__dict__)
15
16
    def __hash__(self): return hash(tuple(self.__dict__.iteritems()))