Confessions of a Python fanboy
robert.kern at gmail.com
Thu Jul 30 19:06:31 EDT 2009
On 2009-07-30 16:44, r wrote:
> On Jul 30, 4:29 pm, Emmanuel Surleau<emmanuel.surl... at gmail.com>
>>> 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
>> It has benefits - code does look better. It has also significant cons - it is
>> For instance:
>> a = b
>> Is b a variable or a method called without parameter?
> Hello Emanuel,
> Again, who so ever names a method with such a non-descriptive name
> will get whats coming to him. And if you did for some reason use such
> a cryptic name as "b", do yourself (and everyone else) a favor and
> follow it with "()" to denote the method call. Remember when something
> is optional that means you have an option to use it OR not use it.
I believe his point is that it is ambiguous to the compiler, not humans reading
the code. Python functions and methods are first class objects. They can be
passed around. If they were auto-called, then you could not do this.
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list