Python and Ruby

Steven D'Aprano steve at
Sun Jan 31 12:35:10 CET 2010

On Sun, 31 Jan 2010 03:01:51 -0800, rantingrick wrote:

> On Jan 30, 10:43 am, Nobody <nob... at> wrote:
>> That's also true for most functional languages, e.g. Haskell and ML, as
>> well as e.g. Tcl and most shells. Why require "f(x)" or "(f x)" if "f
>> x" will suffice?
> yuck! wrapping the arg list with parenthesis (python way) makes the most
> sense. Its to easy to misread somthing like this
> onetwothree four five six
> onetwothree(four, five, six) #ahhh... plain english.

I think the readability factor is mostly down to what you're familiar 
with. But consistency is also important: in Python, you always refer to 
an object the same way. Given an object called x, you ALWAYS refer to the 
object itself as x. In languages that don't use parentheses, x refers to 
the object, unless the object is a function, in which case x refers to 
the result of calling the object with no arguments.

Other languages need special syntax to get access to the function object 
itself. Because it's hard to do, people don't do it often. But in Python, 
getting the function object is easy, and so treating functions as first-
class objects is easy.


More information about the Python-list mailing list