LWN.net Logo

Everything to like

Everything to like

Posted Mar 30, 2005 7:30 UTC (Wed) by Zarathustra (guest, #26443)
In reply to: Everything to like by b7j0c
Parent article: Evidence that Python is advancing into the enterprise (NewsForge)

The lack of a "python-CPAN" it's the least of the problems with Python, and I would argue it's what doomed Perl into an impossibly tangled mess of dependencies.

But Python is not perfect. I use it every day, and I'm annoyed by it's complete lack of any decent concurrency model; stackless does it right, but has been marginated due to Guido's prejudices against recursive programming, a shame because Python together with a CSP model would rock.

Then there are things like (multiple) inheritance, which sadly I think there is no hope we will ever free ourselves of... oh well, I can try to pretend it doesn't exists, if only everyone else didn't feel so compelled to abuse it at every chance.


(Log in to post comments)

Everything to like

Posted Mar 30, 2005 11:03 UTC (Wed) by pkolloch (subscriber, #21709) [Link]

Then there are things like (multiple) inheritance, which sadly I think there is no hope we will ever free ourselves of... oh well, I can try to pretend it doesn't exists, if only everyone else didn't feel so compelled to abuse it at every chance.

Any concrete reasons why you do not like multiple inheritance? I can see that you can abuse them -- it's probably impossible to make a programming language totally abuse prohibitive. I just often wish for multiple inheritance if I program in Java. Look at classes like PropertyChangeSupport which provide some helper classes for event management. If you want to integrate this into an existing class, you either have to program that stuff or use really tedious delegation. Maybe not the best example, but I wanted to use something from the standard library...

Everything to like

Posted Mar 30, 2005 12:44 UTC (Wed) by Zarathustra (guest, #26443) [Link]

There is a big difference between features that can be abused but that can be used properly with some care, and that don't get in the way(eg., C pointers, goto), which is perfectly fine and in many cases a sign of good language design; and features that encourage abuse or that are almost impossible(if at all) to use in sane ways, and that add gratuitous complexity to core parts of the language(eg., multiple inheritance, auto-boxing, "checked exceptions", cpp).

I have yet to see anyone using multiple inheritance in any justifiable way and without ending up with a big mess. And what is worse, MI brings with it an insane amount of complexity into any language that implements it, just look at Python's MRO, it's nauseating the kinds of hacks people puts into their languages to have MI.

Also is not enough not to use MI yourself, as APIs and libraries implemented by naive programmers often force you to use inheritance, mixins are one of the worst ideas I have ever seen, they might seem like a cool hack at first, but end up interacting in unpredictable ways and sending you flying into a world of pain and close coupling among bits that have nothing to do with each other.

And this is not to mean that Single Inheritance is any good either, but at least makes sure that the hierarchies remain within a minimum of sanity, and doesn't force the language to include so many hideous hacks just so it can handle the retarded mess of inheritance models that are possible with MI.

In the end, in a language with a decent type system, inheritance buys you nothing except pain, even the most radical OO zealots, if they have a clue, will tell you to use composition over inheritance if possible, and let me tell you, unless some retarded API forces you or you use a really braindamaged language(eg., Java) you can always do things perfectly fine and with much less trouble without inheritance.

I will finish with the wise words of Rob Pike:

"Object-oriented design is the roman numerals of computing"

inheritance != object oriented

Posted Mar 30, 2005 12:57 UTC (Wed) by zooko (subscriber, #2589) [Link]

I agree with you that inheritance is used way too much. I would be just as happy in a language without inheritance, and when I code in a language with inheritance, I try to avoid it as much as possible. (Such as, to be topical, Python, where the dynamic and structural object oriented make it easy for me to accomplish what I want without using Python's builtin inheritance.)

But inheritance != object oriented. Modern object oriented languages like E don't have inheritance.

inheritance != object oriented

Posted Mar 30, 2005 17:48 UTC (Wed) by Zarathustra (guest, #26443) [Link]

It depends what definition of "Object Oriented" you use. I(and I think rob) was trying to use the most "popular" definition, which probably is not the most accurate.

It has been argued that Limbo is object oriented done right. It has even been argued that Plan 9 is object oriented OS, where files are objects that have a well defined interface.

But in general by OO people understands Java, C++, and if you are lucky, Smalltalk.

By the way, E is quite interesting, I would like to use it for some project, I wonder how it compares with 9p/Limbo and Erlang.

Everything to like

Posted Mar 30, 2005 15:06 UTC (Wed) by cajal (guest, #4167) [Link]

I agree with you that concurrency is one area where Python needs a lot of work. CPython also needs a good modern garbage collector and the ability to return unused memory back to the OS. I love Python and recommend it regularly, but why anyone would try to write an "enterprise" app in a language with monotonically increasing memory usage escapes me.

Everything to like

Posted Mar 30, 2005 17:12 UTC (Wed) by b7j0c (subscriber, #27559) [Link]

>>The lack of a "python-CPAN" it's the least of the problems with Python,
>> and I would argue it's what doomed Perl into an impossibly tangled mess
>> of dependencies.

such as? CPAN has dependency support.

Everything to like

Posted Mar 30, 2005 17:54 UTC (Wed) by Zarathustra (guest, #26443) [Link]

Which is exactly the problem, people loves to abuse it.

Everything to like

Posted Mar 31, 2005 5:14 UTC (Thu) by b7j0c (subscriber, #27559) [Link]

>> Which is exactly the problem, people loves to abuse it.

examples? or is this just more unsubstantiated conjecture?

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds