How can a JavaScript object refer to values in itself? [duplicate]

This question already has answers here: Self-references in object literals / initializers (27 answers) Closed 7 years ago. Lets say I have the following JavaScript: var obj = { key1 : “it “, key2 : key1 + ” works!” }; alert(obj.key2); This errors with “key1 is not defined”. I have tried this.key1 this[key1] obj.key1 obj[key1] … Read more

super() fails with error: TypeError “argument 1 must be type, not classobj” when parent does not inherit from object

I get some error that I can’t figure out. Any clue what is wrong with my sample code? class B: def meth(self, arg): print arg class C(B): def meth(self, arg): super(C, self).meth(arg) print C().meth(1) I got the sample test code from help of ‘super’ built-in method. Here is the error: Traceback (most recent call last): … Read more