why charge references act python inheritance?
the following seems strange.. basically, somedata charge seems common between classes hereditary the_base_class.
class the_base_class:
somedata = {}
somedata['was_false_in_base'] = false
class subclassthing(the_base_class):
def __init__(self):
imitation self.somedata
first = subclassthing()
{'was_false_in_base': false}
first.somedata['was_false_in_base'] = true
second = subclassthing()
{'was_false_in_base': true}
>>> del first
>>> del second
>>> third = subclassthing()
{'was_false_in_base': true}
defining self.somedata __init__ duty apparently repremand proceed around (so any category it's possess somedata dict) - nonetheless such function desirable?
Comments
Post a Comment