From: "John M. Gabriele" Date: 2006-03-12T07:13:43+09:00 Subject: from Python to Ruby in 10 seconds I think this subject might make for a very nice article in the faq (maybe to complement http://www.rubygarden.org/faq/entry/show/14 ), or else possibly could belong at http://www.ruby-doc.org/docs/ . If it's too much to post on this list, please let me know where it might be more appropriate. I'm not asking these questions because I'm too lazy to look them up (I will, regardless), but rather, I think this might be a useful thread. Anyhow, for someone coming from Python to Ruby looking to learn the crucial basic differences in a hurry: - Does Ruby do "everything is a reference to an object" like Python does? Or does it do like Perl where a variable *is* the object, and if you want a reference you need to explicitly take a reference to it? - Python is strongly typed (every object has a type, and the system doesn't automatically convert between types) and dynamically typed (types are figured out at runtime as much as possible). Is Ruby strongly or weakly typed? Dynamically or statically typed? - In Python, everything is an object (including classes and modules too). Is Ruby that way too? - Python has the notion of bound and unbound methods (so that you can call a method like an instance method, or as what looks like a class method if you include an instance of its class in the argument list). Then it also has class methods and static methods too. Does Ruby have bound/unbound methods like this? - With Python, strings and tuples are immutable (for speed, I believe). Does Ruby have immutables like this, or are most object mutable? - Python has import where it loads and runs the module right where it hits that import statement. If the module's already been imported, subsequent imports don't do anything special. Is ruby like this? - Python uses _foo, __bar, and __baz__ underscore notation loosely for private references. Does Ruby have similar notions of "privacy"? - Python has the pydoc command that can read docstrings right there in your .py file and present them as a man page. Can ruby's "ri" command do this too? Or must "rdoc" get involved somehow? Any other "In Python it's like {this}, but in Ruby you do {that}" you can think of would most likely be useful here. Thanks, ---John -- (remove zeez if demunging email address)