MCPcopy Create free account
hub / github.com/ActiveState/code / All

Class All

recipes/Python/252125_Quantum_Superposition/recipe-252125.py:87–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85
86
87class All(Superposition):
88 def _comp(self,other,op):
89 r = super(All,self)._comp(other,op)
90 if len(r) == len(self):
91 return r
92 else:
93 return All()
94
95 def __eq__(self,other):
96 if isinstance(other,Set):
97 r = Set(self) & other
98 if len(r) == len(self):
99 return All(r)
100 else:
101 return All()
102 elif len(self) == 1 and self.eigenstates()[0] == other:
103 print 'in elif'
104 return All(self)
105 else:
106 return All()
107
108if __name__ == '__main__':
109 a = Superposition(1,2,3)

Callers 4

_compMethod · 0.85
__eq__Method · 0.85
recipe-252125.pyFile · 0.85
isprimenumberFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected