3 ms·
Self is a little beginner-unfriendly if they have exposure to other OO languages. In fact the OO model in Python, aside from inheritance/polymorphism, IMO provi
by opportune 6y ago
Self is a little beginner-unfriendly if they have exposure to other OO languages. In fact the OO model in Python, aside from inheritance/polymorphism, IMO provides a rather uncompelling story for why you should use it other than just naked data structures, because its implementation is too close to a dict, and it doesn't offer you good compile time/type checks (or if it does, it's not readily apparent how to take advantage of them) which will lead a beginner to lots of AttributeError
- pyuser583 6y agoI saw a meme that was “what if everything was x” for each programming language. For Python it was “what I’d everything was a hash.”
- dralley 6y ago"self" was what made it finally click for me that methods are just functions that take a copy of the data structure they're operating on. Java's "this" is just kind of implicit magic in comparison, and it didn't accomplish the same understanding.
- pyuser583 6y agoYou should check out Go.