467
Object oriented programming in Python be like:
(media.piefed.ca)
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
What 2003 forum thread did this comment crawl out of?
C/C++ are just scripting languages that have to become OS+arch -specific byte-code before execution.
Python is compiled at "runtime" to a similar OS+arch byte-code minus ELF headers that Linux binaries typically have from gcc.
My point was it's a stupid distinction and worthless when the other points about poor implementations of common language frameworks are plenty on their own is all, and it's needlessly snobbish.
As far as class variable reference however I wish more languages self-referenced. In my eyes it makes it far clearer at a given line of code glance as to where the hell a value came from as opposed to just by name. I feel a keyword like
self::variableName
, or maybe more aptly&self
as a pointer to reference in C++ would be very clear, like Rust does, which is very much, by the original definition, a programming language instead of scripting. Even Java, which is definitely not a scripting language though is still run inside a virtual machine, usesthis
. I don't personally like the term versusself
, but eh.Though if you want a hammer in a screw-driven world look no further than Electron. I think it puts anyone else's even purposeful attempts at such to shame.
You're right in that OOP feels very shoehorned in with Python. But not every project has a Linus Torvalds to publicly humiliate horrible ideas and implementations.
In what way does OOP feel shoehorned in with Python? I ask since that is not my own impression of the language.
Would you also be willing to share what language(s) you feel do(es) OOP without it being shoehorned in?
Yeah, some weird accusations. Python has had classes since its inception (1.0).
Also the image in the post makes no sense. It shows multiple (Spidey) instances all pointing to each other which is not how self works. self is just a parameter that may contain different instances depending how it was called. This is also true for any other parameters in any function, each time a function is called it may have a different instance.
I was looking to see if there are equivalents to Java's private and protected members, and it looks like Python's answer to that is just throw one or two underscores in front of things to do that. And it doesn't really do anything, more of just a naming convention. To me that feels like a basic OO structure that is shoehorned into Python.
A single underscore is just a naming convention, but double underscores triggers automatic name-mangling of the variable in question:
However, much like private/protected variables in java, this is pretty trivial to circumvent if you want.
But I don't believe that you can argue that access modifiers are required for OO not to be shoehorned into a language, not when influential OO languages like Smalltalk didn't have this feature either. Java just happens to be closer to C++, where public/private/protected is much more rigidly enforced than either Java or Python
oop hasn't been "hot" for 20 years.
Might not be hot, but it is sticky.
Hard disagree there. I would argue that most "multi-paradigm" languages converge on the same features, given enough time to iterate. It's not necessarily about hot-sauce. I honestly think its about utility and meeting your userbase where their heads are.