Java Vs Python

Moved from FunctionalVsProceduralVsObjectOrientedProgramming

I'd rather write

    instance = list[2] # python

rather than

    MyClass instance = (MyClass)list.get(2); // Java

almost every time. And for introspection, I'd rather write

    fun = anInstance.method
    fun(3, "guido")

rather than

    import java.lang.reflect.*;
    Method fun = anInstance.getClass().getMethod("method", new Class[] {Integer, String)); // arf
    fun.invoke(anInstance, new Object[] {new Integer(3), "guido"});

every time! (from the JythonLanguage book "Jython Essentials": http://www.oreilly.com/catalog/jythoness ISBN 0-596-00247-5 page 12)

And thank god they can interoperate. (See http://www.jython.org/docs/whatis.html") Er, thank Jim Hugunin and Guido. -- PaulTaney

And why not just do:

    anInstance.method(3, "guido");


CategoryProgrammingLanguage CategoryCoding


EditText of this page (last edited November 9, 2014) or FindPage with title or text search