3 ms·
I don't know that it "is", but it certainly can be. In Python there's just too many ways to screw with the meaning of "a.b" at runtime; it could be in the class
by jerf 9y ago
I don't know that it "is", but it certainly can be. In Python there's just too many ways to screw with the meaning of "a.b" at runtime; it could be in the class dict, it could be a property, it could be modified via a couple of methods on the class, it could be screwed with a couple of other ways too IIRC. You have to write some sort of code that either proves these things can't happen, which gets really hard as the program scales up, or code that checks for them happening. Other languages that can be "dynamic" but still have only one or two things to be checked can be much more easily JIT'ed.
- pjmlp 9y agoSmalltalk has a message called becomes, where you literally change the complete representation of an object to something else. You can change code on the fly on the debugger and just do a redo of the failed call. When you change a specific class, or its meta-class, the whole system is automatically updated, reflecting the changes. I can give many more examples.
- pwang 9y agoI believe much similar magic is possible in Python, but you get to implement it on top of the relatively simple interactions between instance dict, class dict, and metaclass. They would not be bullet-proof, and they are not built into the default implementation. But they are very possible.