Differences between revisions 1 and 9 (spanning 8 versions)
Revision 1 as of 2005-02-05 02:37:04
Size: 1987
Editor: BillDehora
Comment:
Revision 9 as of 2015-04-30 17:58:58
Size: 2782
Editor: JimBaker
Comment: Update to 2.7
Deletions are marked like this. Additions are marked like this.
Line 12: Line 12:
''Jython, lest you do not know of it, is the most compelling weapon the Java platform has for its survival into the 21st century - Sean McGrath'' ''Jython, lest you do not know of it, is the most compelling weapon the Java platform has for its survival into the 21st century - SeanMcGrath''


Line 19: Line 22:
There are numerous [http://grunge.cs.tu-berlin.de/~tolk/vmlanguages.html alternative languages] implemented for the Java VM. The following features help to separate Jython from the rest: There are numerous alternative languages implemented for the Java VM. The following features help to separate Jython from the rest:
Line 30: Line 33:
  * Protyping   * Prototyping
Line 32: Line 35:
  {{{
  >>> from java.util import Date
  >>> d = Date()
  >>> print d
  Sat Jan 08 16:26:16 CST 2005
  >>> from java.util import Random
  >>> print dir(Random)
  ['__init__', 'nextBoolean', 'nextBytes', 'nextDouble', 'nextFloat',
  'nextGaussian', 'nextInt', 'nextLong', 'seed', 'setSeed']
  >>>
}}}
   {{{
    >>> from java.util import Date
    >>> d = Date()
    >>> print d
   Sat Jan 08 16:26:16 CST 2005
    >>> from java.util import Random
    >>> print dir(Random)
    ['__init__', 'nextBoolean', 'nextBytes', 'nextDouble', 'nextFloat',
    'nextGaussian', 'nextInt', 'nextLong', 'seed', 'setSeed']
    >>>
  
}}}
Line 44: Line 48:
  * Bean properties accesible
  {{{
  >>> print Date().time
  1105500911121
  }}}
  * Glue together libraries already written in Java
  * Making bean properties accessible
    {{{
   >>> print Date().time
    1105500911121
    }}}

  * Glues together libraries already written in Java
Line 54: Line 59:

----

== Differences - Python & Jython ==

'''Python 2.7'''
  * C
  * Multi-platform
  * Compiles to .pyc
  * Extend with C
  * GIL <<FootNote(Global Interpreter Lock, explained in [http://docs.python.org/api/threads.html Python documentation, chapter 8.1])>>
  * Python garbage collection, which mixes ref counting and mark and sweep

'''Jython 2.7'''
  * Written mostly in Java, does use Java Native Runtime for C access, but works with security manager restrictions
  * Java 7 or Java 8
  * Compiles to $py.class files
  * Extend with Java or C using JFFI; full CFFI, ctypes, and C Extension API support planned for the future
  * Truly multi-threaded
  * Java garbage collection, including choice of standard Java GCs; but also provides same API as Python 2.7 to observe GC

Jython, lest you do not know of it, is the most compelling weapon the Java platform has for its survival into the 21st century - SeanMcGrath


Why Jython

There are numerous alternative languages implemented for the Java VM. The following features help to separate Jython from the rest:

  • Dynamic compilation to Java bytecodes - leads to highest possible performance without sacrificing interactivity.
  • Ability to extend existing Java classes in Jython - allows effective use of abstract classes.
  • Optional static compilation - allows creation of applets, servlets, beans, ...
  • Bean Properties - make use of Java packages much easier.
  • Python Language - combines remarkable power with very clear syntax. It also supports a full object-oriented programming model which makes it a natural fit for Java's OO design.

What Does Jython Do Well?

  • Prototyping
  • Java investigation
    •     >>> from java.util import Date
          >>> d = Date()
          >>> print d
          Sat Jan 08 16:26:16 CST 2005
          >>> from java.util import Random
          >>> print dir(Random)
          ['__init__', 'nextBoolean', 'nextBytes', 'nextDouble', 'nextFloat',
          'nextGaussian', 'nextInt', 'nextLong', 'seed', 'setSeed']
          >>>
  • Making bean properties accessible
    •     >>> print Date().time
          1105500911121
  • Glues together libraries already written in Java
  • Excellent embedded scripting language


Differences - Python & Jython

Python 2.7

  • C
  • Multi-platform
  • Compiles to .pyc
  • Extend with C
  • GIL 1

  • Python garbage collection, which mixes ref counting and mark and sweep

Jython 2.7

  • Written mostly in Java, does use Java Native Runtime for C access, but works with security manager restrictions
  • Java 7 or Java 8
  • Compiles to $py.class files
  • Extend with Java or C using JFFI; full CFFI, ctypes, and C Extension API support planned for the future
  • Truly multi-threaded
  • Java garbage collection, including choice of standard Java GCs; but also provides same API as Python 2.7 to observe GC
  1. Global Interpreter Lock, explained in [http://docs.python.org/api/threads.html Python documentation, chapter 8.1] (1)

WhyJython (last edited 2015-04-30 17:58:58 by JimBaker)