News for hackers. Stuff that matters.
Re:Ask HN: How will it impact my webapp if it is written in ... by stevenwei on Wednesday July 07, 2010 @03:50AM (#1493658)
Agreed. Even if these two pieces of code might accomplish the same thing, at least the Python version doesn't make me want to stab myself in face whenever I write it:

Invoking an object callback in PHP:

    call_user_func_array(array($object,'method_name'),array($arg1,$arg2,$arg3)); 
Invoking an object callback in Python:

    object.method_name(arg1,arg2,arg3)

    (Python's *args and **kwargs are especially useful in these types of situations.)
Although PHP is slowly adding useful modern language features (lambdas, closures), some of the syntax really is terrible. I honestly can't imagine anyone preferring the former to the latter, at least in this example.

There are no comments on this comment yet.