/m.py
Created
June 9, 2013 19:27
Revisions
-
fajran created this gist
Jun 9, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ class M(object): def __init__(self, posisi, asam_amino): self.posisi = posisi self.asam_amino = asam_amino def __repr__(self): return "%s%s" % (self.posisi, self.asam_amino) def __eq__(self, o): if not isinstance(o, M): return False return self.posisi == o.posisi \ and self.asam_amino == o.asam_amino def __hash__(self): return hash((self.posisi, self.asam_amino)) mutasi = [ M(1, "a"), M(2, "b"), M(1, "c"), M(3, "b"), M(1, "a") ] print mutasi print set(mutasi)