Hit counter:

Sunday, October 23, 2011

Python: Object-oriented programming


I looked up some of the object-oriented features of Python last night, and apparently, it doesn't fare bad here. In fact, its object orientation is more similar to Modula-3 rather than Java, which is inherently a good thing. Namely, one can program using the Object oriented paradigm, but isn't obligated to. Classes can be defined with no members, which can be dynamically added, but not methods. Everything is public, and that's weird, but livable with. What's kind of weird is that everything in Python seems to be an object. Namely, everything inherits from the object class, whether it's a simple integer or uber special epic data type. Cool in some ways, bad with multiple inheritance, which is rather well supported, even though it's optimization hell with the multiple inheritance routes to Object. Method parameters are passed by reference, which makes up for the lack of pointers in some cases- sadly, not well nor everywhere, as it's a major hassle to wrap up everything you want passed by reference in a class. Will definitely need to ask some python programmers at the hacklab how on earth they handle this problem (though i'll bet they'll tell me to wrap in classes, then pass).

No comments:

Post a Comment