FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python/python_DS/hash.py at master · sriaman/python · GitHub
sriaman
python
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python
/
python_DS
/
hash.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
15 lines (12 loc) · 364 Bytes
Breadcrumbs
python
/
python_DS
/
hash.py
Copy path
File metadata and controls
15 lines (12 loc) · 364 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#example of hashfunction
class
Person
:
def
__init__
(
self
,
age
,
name
):
self
.
age
=
age
self
.
name
=
name
def
__eq__
(
self
,
other
):
return
self
.
age
==
other
.
age
and
self
.
name
==
other
.
name
def
__hash__
(
self
):
print
(
'The hash is:'
)
return
hash
((
self
.
age
,
self
.
name
))
person
=
Person
(
23
,
'Adam'
)
print
(
hash
(
person
))
Back
|
FazBrowse Home
|
New Git URL