Created
May 4, 2015 18:39
-
-
Save sparticlesteve/9719d699e8c716246a3e to your computer and use it in GitHub Desktop.
Demonstrate error from operator== usage for SystematicVariation
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 characters
#!/usr/bin/env python | |
from ROOT import gROOT | |
gROOT.SetBatch() | |
from ROOT import gSystem | |
gSystem.Load('libPATInterfaces.so') | |
from ROOT import CP | |
from ROOT.CP import SystematicVariation | |
# Get the equality operator | |
eq = getattr(CP, 'operator==') | |
# Custom comparison works | |
#def comp_systs(self, other): | |
# return eq(self, other) | |
#SystematicVariation.__eq__ = comp_systs | |
# Setting operator directly gives error | |
SystematicVariation.__eq__ = eq | |
# Two "equal" objects | |
s1 = SystematicVariation('sys', 1) | |
s2 = SystematicVariation('sys', 1) | |
print 's1 == s2:', s1 == s2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Error message: