BJörn Lindqvist wrote:
Because it contains more non-significant symbols (, ), { and } that
"steal" the programmers attention. But consider

def f(x, y, z)
    print x, y, z

to

def f(x, y, z):
    print x, y, z

IMHO, the colon-less variant is more readable than the one with the colon.

Except that it is quite acceptable to do the following:

  def f(x, y, z,
        long_func_arg_name):
    long_func_arg_name(x, y, z)


def f(x, y, z, long_func_arg_name) long_func_arg_name(x, y, z)

The colons do a decent job of flagging the beginning of suites, mainly because of Python general lack of *other* punctuation (e.g. the colon would be entirely ineffective at improving readability if every line ended with a semi-colon).

Cheers,
Nick.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to