From: gabriele renzi Date: 2005-12-21T07:57:51+09:00 Subject: Re: Bruce Eckel wouldn't know why to switch from Python to Ruby rcoder ha scritto: > Eckel's article is getting pretty long in the tooth at this point -- I > remember reading it back when I was a Python user several years ago, > and it actually delayed my swith to Ruby for a few months, at least. I > probably don't qualify as a Python expert, but after being exposed to > both for non-trivial projects, there are definitely some differences > that make me prefer Ruby. > > First, because all object "slots" in Python are public, (stupid > conventions like underscore prefixes aside) you see a lot of code like > this: > > obj.setFoo("bar") > > This is because 'obj.foo = "bar"' is a direct assignment, with no > method call involved. I think you'have been away from python far too long, recent python (3 or 4 versions I think_) has a nice thing called properties. Basically you can declare "foo" to have setters and getters when you need it, and still threat them in the same way (i.e. "obj.foo = bar" becomes a method call). 80% of the times someone writing a setFoo or getFoo is doing it because (s)he was a java/c++ developer. OTOH I notice that you're aware of the decorator syntax which is far more recente, so maybe this thing just slipped away :)