|
|
|
|
|
by 198d
5297 days ago
|
|
It's interesting that you bring up Javascript. I've just started working in Python full-time recently and have noticed the OOP stuff "feels" a little like working with objects in Javascript. Specifically around how the built in super works and more generally how methods are defined on classes to begin with. In Javascript you can do interesting things with call and apply on function objects to share functionality between two objects that work the same. Similarly in Python, since the methods defined in a class are also available on the class object itself, you can use them outside of an instance and simply give them a self to operate on. The class object almost acts like the prototype object on the function object you're using as a constructor. I know the two systems are different, but they do "feel" real similar. Most people I mention this to seem a bit surprised and have that "never thought of that" look on their face. Anyone else witness this? |
|