11 ms·
It seems to me like pre-OOP Python. I'm not a fan of overusing classes, and a lot can be accomplished in Python without them. But from one perspective, you're j
by jmilloy 12y ago
It seems to me like pre-OOP Python. I'm not a fan of overusing classes, and a lot can be accomplished in Python without them. But from one perspective, you're just reimplementing (a subset of) classes and preferring to type out the underlying dictionary instead of letting the existing syntax do it for you. So one answer is because easier to type and read.
Another answer is that you are, in fact, using classes, you're just not using the 'class' identifier and syntax (assuming you're library was fleshed out to include all the missing features that your toy example is missing). Why doesn't Python offer three different class implementations and syntax? Why did you use a dictionary in your example, instead of implementing your own key-value object with hashing functions? Why are you using Python at all, instead of writing directly machine code?