Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
tokumei21226y?????
Because everything, including functions, classes, and metaclasses, is a first class item in Python. You literally can't have two functions that have the same name, but you can make a single function change its behavior with different sets of inputs by utilizing *args, **kwargs, and default values. -
@tokumei Same name, but different signature.
And these "workarounds" are.. well.. workarounds. Not something intuitive. But I guess quite nothing is intuitive in Py.
Still better than Perl though. At least code does not look like a CBC-encrypted file -
@irene separation of concerns for each method/constructor, clean code paradigms.
Constructors to (#1) fill data structure either from data stream (which means lots of parsing) and (#2) to fill data structure manually, by supplying each field separately. #3 -- a copy-constructor
Default values... well, that's just messy -
maybe it's the limitation of dynamic typing ? but lately python implemented a static parameter type tho, never tried to use overloading in python using that.
-
Dont look at python as anything serious and you wont be disappointed. Learned it the hard way.
-
@irene its strange because this is one of the instances in which I can see what the op means but at the same time I still enjoy the language. Yes, we would normally use class methods, and even tho we can't have them have the same names I for one find it useful and easier to understand than the standard approach to other oop languages in which overloaded methods is a matter of different arguments.
But I guess what op means is that it feels sorta hacky? At least to me it does. Is it in the docs? If i see this shit in the docs I will legit feel better about the hackyness. -
If you think about it, it's obvious that class-based OOP in a dynamically typed language doesn't really make a whole lot of sense in the first place
-
@AleCx04 prototypes would indeed have been a lot more appropriate lol
They're actually one of the things i like about js, for example -
@irene not disagreeing either, hence my comment ^^
Was trying to point out that a lot of people just go "yay, classes" without ever thinking through what the implications are -
vane110496yBecause inheritance is creation of devil who want to hide it’s sins in the parent.
Use mixins.
Don’t try to java in python. -
Ikr!
I've had the same issue.
Only weird thing was: it worked until, all of a sudden, it didn't.
It was working just fine until it suddenly said I too many arguments,taking one out, didn't have enough arguments.. Wth Python? -
@irene ooh with that one I was just trolling. I have never been a real fan of oop and prefer a more procedural/functional approach to handling ma business. Which is why I am deeply in love with C and Lisp respectively.
I don't get to use neither one at work tho :( ;___; i would kill for an opportunity to work with C. But being that my resume is more oriented towards web development with other languages i sometimes wonder if i will ever get a chance. -
Very few dynamically typed languages support overloading. Look at JavaScript, Lua, etc.
-
@irene "Very few dynamically typed languages support overloading"
I then gave two examples. I dunno where the confusion came from, but I think we are in agreement.
Related Rants
WTF python.... How the fuck are you an OOP language and unable to overload constructors...?
No method overloading... and they say JAVA is a shitty language.
rant
fuck python