-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbbl.py
28 lines (21 loc) · 822 Bytes
/
bbl.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
class BBL:
def __init__(self, borough, block, lot):
self.borough = borough
self.block = block
self.lot = lot
self.bbl_repr = long(borough*1000000000+block*10000+lot)
def __eq__(self, other):
return (isinstance(other, self.__class__)
and self.bbl_repr == other.bbl_repr)
def __ne__(self, other):
return not self.__eq__(other)
def __cmp__(self, other):
return self.bbl_repr - other.bbl_repr
def __getitem__(self, name):
return self.__dict__[name]
def __repr__(self):
return str(self.__dict__)
def __str__(self):
return str(self.borough) + '-' + str(self.block) + '-' + str(self.lot)
def __hash__(self):
return hash(self.bbl_repr)