Classpath Considered Harmful
April 26th, 2004I am glad to see I am not the only one who has problems with classpaths in java. Many of the advantages that python has over java, PHP has as well. Lack of classpath is certainly one of them, but dynamic typing is my favorite.
April 27th, 2004 at 2:42 am
Comparing PHP with Python is an interesting experience; there is alot of common ground, although Python aims to be a general purpose language while PHP targets web applications. The other division on typing is strong vs. weak and I think it’s fair to say Python is strongly typed while PHP is weakly typed e.g.;
Python;
$myInt = 4;
print "The number is "+myInt; # Illegal interpolation
print "The number is "+str(myInt); # Cast to string
PHP;
myInt = 4;
print "The number is ".$myInt;
That works in PHP’s favor when it comes to generating HTML while, at the same time, more effort is needed if you want to validate a submitted variable, to check it’s an integer.
Python generally feels “better rounded”; there are many things I’d love to see in PHP, import in particular plus things like distutils and the notion that everything is an object.
At the same time think PHP’s class syntax is preferable, hiding you from the fact that the interpreter really regards objects as glorified hashes while Python requires you specify the self reference inside a class.
Also Python hasn’t got databases nailed down yet, at least when it comes to using a DB to “drive” a website. John Lim is working on porting ADOdb to Python: http://php.weblogs.com/adodb_python