I'm not sure if the output of this code is correct or a bug:
class F:
"""An abstract class"""
list_of_secrets = []
def __init__(self):
pass
def getSecret(self):
return self.list_of_secrets
class F_None(F):
pass
class F_Some(F):
def __init__(self):
self.list_of_secrets.append("secret value!")
x = F_Some()
print "x:",x.getSecret()
y = F_None()
print "y:",y.getSecret()
The output using python 2.7.3:
x: ['secret value!']
y: ['secret value!']
I think it should output:
x: ['secret value!']
y: []
Any thoughts?