3 ms·
If anyone ever wonders why Python has the explicit self-variable, this is the answer. If you define a local class inside a method inside a class, you will have
by exDM69 15y ago
If anyone ever wonders why Python has the explicit self-variable, this is the answer. If you define a local class inside a method inside a class, you will have two variables called "this" or "self" and it may be practical to refer to both of them. Sometimes you see JavaScript with "var self = this;" or something similar.