Confessions of a Python fanboy

Emmanuel Surleau emmanuel.surleau at gmail.com
Thu Jul 30 17:29:21 EDT 2009


> 1.) No need to use "()" to call a function with no arguments.
> Python --> "obj.m2().m3()" --ugly
>   Ruby --> "obj.m1.m2.m3"  -- sweeet!
> Man, i must admit i really like this, and your code will look so much
> cleaner.

It has benefits - code does look better. It has also significant cons - it is 
ambiguous.
For instance:

a = b

Is b a variable or a method called without parameter?

> 2.) the .each method
> container.each{|localVar| block}
> This method can really cleanup some ugly for loops, although i really
> like the readability of for loops.

It's not only the 'each' method. It's "anonymous callbacks everywhere", which 
is pretty cool. Certainly one of my favourite features of Ruby.

> 3.) true OOP
> Now before you go and get all "huffy" over this statement, hear me
> out. Python is the best language in the world. But it damn sure has
> some warts! "len(this)" instead of "obj.length" max(that) instead of
> [1,2,3,4,5].max(). You know what i am talking about here people. We
> all get complacent and It seems easier to just cope with these
> problems instead of fighting for change.

While ob.length() is more clear to read, it follows the same "operator" logic 
as __iter__. Which is OK, I suppose.

> But look at the French,  WHAT
> THE HELL HAS THAT DONE FOR THEM, *NOTHING*!!!!

I assume this was supposed to be funny?

> As for the rest of Ruby, i am not impressed. The redundant usage of
> "end" over indention perplexes me.

You have the choice to use {}. If you are confused over languages which do not 
use indentation to delimit code blocks, you should probably try out a few 
languages outside Python.

> The Perlish feel of "require" and
> the horrifically cryptic idioms of Ruby regular expressions.

Cryptic idioms of Ruby regular expressions? They are Perl-like regular 
expressions, not exactly a far cry from what re does. Also, you can chain 
them, which is extremely nice.

> The "puts" and "gets" seem childish

Well, they're short and easy. Writing "gets" is more intuitive than using 
raw_input()

> and the math class does not even have
> a degrees or radians function!
>
> Anyway, i thought i would get this off my chest and catch up with old
> friends in the meantime. We can all make Python the perfect language
> it needs to be, but it ain't gonna be easy!
> Thank you all
>
> PS stay tuned for more from this series....

Cheers,

Emm



More information about the Python-list mailing list