On Tuesday 23 October 2001 11:20, you wrote: > Ouch! > > http://www.mindview.net/Etc/FAQ.html#Ruby > > Thoughts? Disclaimer: I have written approximately 100,000 lines of Python in the past 2 years, and approximately 10,000 lines of Ruby in the past 2 months. Thus I am approximately 10 times more expert in Python than in Ruby. I don't, however, have any particular axe to grind regarding languages, heck, I even write my web pages in PHP (one of the most bletcherous excuses for a programming language to come down the pike -- but excellent for quicky one-off weblets). Thoughts: 1. Python's namespace conventions (i.e., no "global" global variables, only module-global variables) make it easier to partition a large project amongst various programmers, especially projects that require configuration variables of some sort (which are "global""), where you can divide them amongst several programmers/several modules without worrying about conflicts. 2. DRB (Distributed Ruby) is *MUCH* simpler and easier than anything that the Python folks have devised. The similarity to Java's distributed programming model makes it a good prototyping mechanism for distributed Java programs. 3. I like being able to add methods to an already-existing class in Ruby. This makes many things much easier. 4. I like being able to pass around a method in Python. This makes many things much easier. 5. Multiple inheritance is good in Python. 6. I like the 'module' concept in Ruby, which works around many of the problems with multiple inheritence, but not enough to consider it a full replacement for multiple inheritance. 7. Access to object namespace in Python allows very easy self-referential classes. 8. Ruby extension modules are *MUCH* easier to write than Python ones (and I've written a few Python ones in my time). 9. Reference counting (Python) is more memory-efficient than garbage collection (Ruby), since it frees up memory as references are destroyed rather than waiting until a garbage collector runs. Python does need a garbage collector to collect circularly-referenced objects though, so Python's lack of garbage collection overhead has to be offset by the fact that circular references currently hang around forever. 10. Reference counting works hand-in-hand with Python's destructors to handle resource cleanups in a real-time manner that's difficult with Ruby (where you can set up destructors of a sort but they only run at garbage collection time, which may be some time later, in the meantime you still have some open files and files on disk hanging around that are not getting cleaned up). 11. Iterators (Ruby) are good stuff. 12. Python is no speed demon, but is faster than Ruby for the things I do. 13. Python has a nice GUI-based debugger, which makes many things easier. 14. Ruby has a nice shell-ish/perl-ish 'backtic' syntax which makes many things much quicker to write than in Python, which is rather anal and European in its treatment of Unix-y stuff. 15. Python has a much better Emacs mode than Ruby. I especially like the class browser. Final conclusions: I must agree with Bruce Eckel that I could not recommend that a Python programmer move to Ruby except in very special circumstances, because the two languages are so similar that there's no real advantage to doing so. In my case I'm using Ruby because I needed to prototype a distributed application and the various Python frameworks were too complex and difficult to use compared to Distributed Ruby. There are also some legal reasons stemming from past employment for not using Python in certain applications, reasons that I won't discuss here. My preliminary conclusion is that Python is a superior language for large projects. It is virtually impossible to make a difficult-to-read Python program due to its indentation-based syntax, the namespace partitioning makes large projects easier to partition amongst multiple programmers or multiple programming groups, and there is a large number of enterprise-oriented libraries for access to various proprietary and non-proprietary external systems. It is also portable to more architectures than Ruby, which is important for some large multi-platform applications. Python's syntax is also more regular and consistent than Ruby's, which again is important for large multi-programmer projects. Ruby, on the other hand, is a much better scripting language (as vs. general-purpose programming language) than Python. It is much easier to chain pieces together, especially for distributed applications. It also makes a superior language for prototyping Java applications, since many aspects (iterators, rinda, single inheritance only, etc.) are similar to Java. I would not, however, relish attempting to manage 100K+ lines of Ruby code for a project, while Python proved to be quite usable for 100K+ lines of code. -- Eric Lee Green GnuPG public key at http://badtux.org/eric/eric.gpg mailto:eric / badtux.org Web: http://www.badtux.org You do not save freedom by destroying freedom