SlideShare a Scribd company logo
Jython: Integrating
   Python and Java
            Charles Anderson
         Western Skies Consulting
        Western Oregon University
charles@western-skies.us / andersc@wou.edu
10 Second Summary


• Jython is the Python interpreter
  implemented in Java
Outline

• Python
• Scripting and embedded languages
• Jython
• Other Java scripting languages
Python Background
• Python is a object-oriented scripting
  language - runs on many platforms
• Mature but still evolving: version 1.0 -
  1994, current version: 2.5, 3.0 under
  development
• Huge user base including Google,Yahoo,
  YouTube, Industrial Light & Magic
Python Overview
• Python is a scripting language - no compile
• Dynamic typing - no variable declarations,
  but strictly typed at runtime
• Simple syntax - large library rather than
  cryptic syntax (c.f., Perl)
• Often a refuge from other languages
Hello World

• print    “hello world”



• that’s it - no semicolons, no main function,
  no curly braces, etc.
Language Features

• Object oriented: hybrid/not pure, multiple
  inheritance - c.f., C++
• Polymorphism without inheritance - “duck
  typing”
• Very dynamic - introspection/reflection is
  simple and powerful - c.f., Java
Syntax

• Pretty simple - familiar to Java programmers
  c = sqrt(a*a, b*b)
  emp = Employee(‘Bob’, ‘Jones’)
  employees[‘Bob’] = emp
  import sys, email.mime.text
More Syntax
if x < 0:
  print ‘negative’
try:
  z=y/x
except ZeroDivisionError, msg:
  print msg
Class Definition
class Point2D:
  def __init__(self, x, y):
    self.x = x
    self.y = y
  def distance(self):
    return math.sqrt(
              self.x**2+self.y**2)
Syntax Notes
• The block structure of code is determined
  by indentation - what you see is what the
  compiler sees
  • No dangling curly braces
• Python favors libraries over fancy, terse
  syntax - c.f., Perl

  • When needed, __method__
Embedded Languages
• TCL was developed to provide a common
  command language for tools written in C
• Adding command line to tools
• Extending TCL to add commands from C
  to TCL
• Similar to Unix shell - C functions instead
  of executable programs
Extending TCL
• TCL uses a simple interface between TCL
  and C code: int argc, char** argv

• Programmer writes thin layer of interface
  functions to expose functionality to TCL
  •   Programmer has to choose functions to be
      exposed

• Can be automated - swig
Scripting a Program
• Do the real work in C (or whatever) and
  glue it together with TCL
 •   Provides extensibility of C tool to users

• Performance of script language doesn’t
  really matter - Pareto principal
 •   E.g., Numeric Python at LLNL

• Can prototype in scripting language
Python Interpreter
• Python is an interpreted language - need an
  interpreter to execute Python code
• Originally written in C - “CPython”
• Code is compiled to byte codes at runtime
• Python can be interfaced with existing C
  code similar to TCL
Jython Interpreter

• Jython is Python interpreter written in Java
• Python code is compiled to Java byte codes
• Aside: Iron Python is interpreter written
  to .Net CLR
Jython Ramifications
• Interpreter written in Java - so what?
• Jython interfaces directly to Java w/o any
  explicit coding
  •   Uses Java introspection/reflection

  •   All Java classes on class path are immediately
      available from Python code

  •   Interactive command line for Java
Demos


• Interactive
• GUI
Java Python Integration

• Python can call Java code
• Java code can call out to Python - possibly
  in a new Python interpreter (sandbox)
• Python code can sub-class Java classes
Possible Uses

• Command prompt for controlling app
• Interactive workbench for experimenting
• One-off utility work - e.g., data loading
• Flexible “business” rules
Scripting Java

• Groovy - groovy.codehaus.org
• JACL (TCL in Java) - tcljava.sourceforge.net
• JRuby - jruby.codehaus.org
• JSR 223 Scripting the Java Platform -
  Java 6 SE
Jython Information

• www.jython.org
• There are a couple of Jython books
• “Scripting: Higher Level Programming for
  the 21st Century” - Ousterhout

More Related Content

What's hot

Python Programming - XIII. GUI Programming
Python Programming - XIII. GUI ProgrammingPython Programming - XIII. GUI Programming
Python Programming - XIII. GUI ProgrammingRanel Padon
 
Python
PythonPython
PyPy 1.2: snakes never crawled so fast
PyPy 1.2: snakes never crawled so fastPyPy 1.2: snakes never crawled so fast
PyPy 1.2: snakes never crawled so fast
PyCon Italia
 
Phython Programming Language
Phython Programming LanguagePhython Programming Language
Phython Programming Language
R.h. Himel
 
Introduction about Python by JanBask Training
Introduction about Python by JanBask TrainingIntroduction about Python by JanBask Training
Introduction about Python by JanBask Training
JanBask Training
 
Python Flavors
Python FlavorsPython Flavors
Python Flavors
Geison Goes
 
What is Python? An overview of Python for science.
What is Python? An overview of Python for science.What is Python? An overview of Python for science.
What is Python? An overview of Python for science.
Nicholas Pringle
 
Python Tutorial for Beginner
Python Tutorial for BeginnerPython Tutorial for Beginner
Python Tutorial for Beginner
rajkamaltibacademy
 
Intro dotnet
Intro dotnetIntro dotnet
Golang basics for Java developers - Part 1
Golang basics for Java developers - Part 1Golang basics for Java developers - Part 1
Golang basics for Java developers - Part 1
Robert Stern
 
Golang for OO Programmers
Golang for OO ProgrammersGolang for OO Programmers
Golang for OO Programmers
khalid Nowaf Almutiri
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
Ranjith kumar
 
Why I Love Python
Why I Love PythonWhy I Love Python
Why I Love Python
didip
 
Python final ppt
Python final pptPython final ppt
Python final ppt
Ripal Ranpara
 
Python quick guide1
Python quick guide1Python quick guide1
Python quick guide1Kanchilug
 
Introduction to python 3
Introduction to python 3Introduction to python 3
Introduction to python 3
Youhei Sakurai
 
Come With Golang
Come With GolangCome With Golang
Come With Golang
尚文 曾
 
Presentation on python
Presentation on pythonPresentation on python
Presentation on python
william john
 
Python for All
Python for All Python for All
Python for All
Pragya Goyal
 
Introduction to python 3 2nd round
Introduction to python 3   2nd roundIntroduction to python 3   2nd round
Introduction to python 3 2nd round
Youhei Sakurai
 

What's hot (20)

Python Programming - XIII. GUI Programming
Python Programming - XIII. GUI ProgrammingPython Programming - XIII. GUI Programming
Python Programming - XIII. GUI Programming
 
Python
PythonPython
Python
 
PyPy 1.2: snakes never crawled so fast
PyPy 1.2: snakes never crawled so fastPyPy 1.2: snakes never crawled so fast
PyPy 1.2: snakes never crawled so fast
 
Phython Programming Language
Phython Programming LanguagePhython Programming Language
Phython Programming Language
 
Introduction about Python by JanBask Training
Introduction about Python by JanBask TrainingIntroduction about Python by JanBask Training
Introduction about Python by JanBask Training
 
Python Flavors
Python FlavorsPython Flavors
Python Flavors
 
What is Python? An overview of Python for science.
What is Python? An overview of Python for science.What is Python? An overview of Python for science.
What is Python? An overview of Python for science.
 
Python Tutorial for Beginner
Python Tutorial for BeginnerPython Tutorial for Beginner
Python Tutorial for Beginner
 
Intro dotnet
Intro dotnetIntro dotnet
Intro dotnet
 
Golang basics for Java developers - Part 1
Golang basics for Java developers - Part 1Golang basics for Java developers - Part 1
Golang basics for Java developers - Part 1
 
Golang for OO Programmers
Golang for OO ProgrammersGolang for OO Programmers
Golang for OO Programmers
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Why I Love Python
Why I Love PythonWhy I Love Python
Why I Love Python
 
Python final ppt
Python final pptPython final ppt
Python final ppt
 
Python quick guide1
Python quick guide1Python quick guide1
Python quick guide1
 
Introduction to python 3
Introduction to python 3Introduction to python 3
Introduction to python 3
 
Come With Golang
Come With GolangCome With Golang
Come With Golang
 
Presentation on python
Presentation on pythonPresentation on python
Presentation on python
 
Python for All
Python for All Python for All
Python for All
 
Introduction to python 3 2nd round
Introduction to python 3   2nd roundIntroduction to python 3   2nd round
Introduction to python 3 2nd round
 

Viewers also liked

Jython 2.7 and techniques for integrating with Java - Frank Wierzbicki
Jython 2.7 and techniques for integrating with Java - Frank WierzbickiJython 2.7 and techniques for integrating with Java - Frank Wierzbicki
Jython 2.7 and techniques for integrating with Java - Frank Wierzbicki
fwierzbicki
 
Java VS Python
Java VS PythonJava VS Python
Java VS Python
Simone Federici
 
From Java to Python: beating the Stockholm syndrome
From Java to Python: beating the Stockholm syndromeFrom Java to Python: beating the Stockholm syndrome
From Java to Python: beating the Stockholm syndrome
Javier Arias Losada
 
[PyCon 2014 APAC] How to integrate python into a scala stack to build realtim...
[PyCon 2014 APAC] How to integrate python into a scala stack to build realtim...[PyCon 2014 APAC] How to integrate python into a scala stack to build realtim...
[PyCon 2014 APAC] How to integrate python into a scala stack to build realtim...Jerry Chou
 
Jython
JythonJython
Jython
jbrendel
 
SyPy IronPython
SyPy IronPythonSyPy IronPython
SyPy IronPython
Nick Hodge
 
KScope14 Jython Scripting
KScope14 Jython ScriptingKScope14 Jython Scripting
KScope14 Jython Scripting
Alithya
 
Jython
JythonJython
Web Development with Python and Django
Web Development with Python and DjangoWeb Development with Python and Django
Web Development with Python and Django
Michael Pirnat
 
Learn 90% of Python in 90 Minutes
Learn 90% of Python in 90 MinutesLearn 90% of Python in 90 Minutes
Learn 90% of Python in 90 Minutes
Matt Harrison
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
Nowell Strite
 
Git and github introduction
Git and github introductionGit and github introduction
Git and github introduction
John(Qiang) Zhang
 
Python y Flink
Python y FlinkPython y Flink
Python y Flink
Paradigma Digital
 
Automating and Accelerating Application Deployments to IBM WebSphere without ...
Automating and Accelerating Application Deployments to IBM WebSphere without ...Automating and Accelerating Application Deployments to IBM WebSphere without ...
Automating and Accelerating Application Deployments to IBM WebSphere without ...
XebiaLabs
 
Java Serialization
Java SerializationJava Serialization
Java Serialization
jeslie
 
The .NET developer's introduction to IronPython
The .NET developer's introduction to IronPythonThe .NET developer's introduction to IronPython
The .NET developer's introduction to IronPython
Dror Helper
 
Ruby vs python
Ruby vs pythonRuby vs python
Ruby vs pythonIgor Leroy
 
Why Learn Python?
Why Learn Python?Why Learn Python?
Why Learn Python?
Christine Cheung
 

Viewers also liked (20)

Jython 2.7 and techniques for integrating with Java - Frank Wierzbicki
Jython 2.7 and techniques for integrating with Java - Frank WierzbickiJython 2.7 and techniques for integrating with Java - Frank Wierzbicki
Jython 2.7 and techniques for integrating with Java - Frank Wierzbicki
 
Java VS Python
Java VS PythonJava VS Python
Java VS Python
 
From Java to Python: beating the Stockholm syndrome
From Java to Python: beating the Stockholm syndromeFrom Java to Python: beating the Stockholm syndrome
From Java to Python: beating the Stockholm syndrome
 
[PyCon 2014 APAC] How to integrate python into a scala stack to build realtim...
[PyCon 2014 APAC] How to integrate python into a scala stack to build realtim...[PyCon 2014 APAC] How to integrate python into a scala stack to build realtim...
[PyCon 2014 APAC] How to integrate python into a scala stack to build realtim...
 
Jython
JythonJython
Jython
 
SyPy IronPython
SyPy IronPythonSyPy IronPython
SyPy IronPython
 
KScope14 Jython Scripting
KScope14 Jython ScriptingKScope14 Jython Scripting
KScope14 Jython Scripting
 
Jython
JythonJython
Jython
 
Web Development with Python and Django
Web Development with Python and DjangoWeb Development with Python and Django
Web Development with Python and Django
 
Learn 90% of Python in 90 Minutes
Learn 90% of Python in 90 MinutesLearn 90% of Python in 90 Minutes
Learn 90% of Python in 90 Minutes
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 
Introduction to jython
Introduction to jythonIntroduction to jython
Introduction to jython
 
Git and github introduction
Git and github introductionGit and github introduction
Git and github introduction
 
Hiring_Data_Scientist
Hiring_Data_ScientistHiring_Data_Scientist
Hiring_Data_Scientist
 
Python y Flink
Python y FlinkPython y Flink
Python y Flink
 
Automating and Accelerating Application Deployments to IBM WebSphere without ...
Automating and Accelerating Application Deployments to IBM WebSphere without ...Automating and Accelerating Application Deployments to IBM WebSphere without ...
Automating and Accelerating Application Deployments to IBM WebSphere without ...
 
Java Serialization
Java SerializationJava Serialization
Java Serialization
 
The .NET developer's introduction to IronPython
The .NET developer's introduction to IronPythonThe .NET developer's introduction to IronPython
The .NET developer's introduction to IronPython
 
Ruby vs python
Ruby vs pythonRuby vs python
Ruby vs python
 
Why Learn Python?
Why Learn Python?Why Learn Python?
Why Learn Python?
 

Similar to Jython: Integrating Python and Java

AOT-compilation of JavaScript with V8
AOT-compilation of JavaScript with V8AOT-compilation of JavaScript with V8
AOT-compilation of JavaScript with V8
Phil Eaton
 
C Language
C LanguageC Language
C Language
Syed Zaid Irshad
 
Practical SystemTAP basics: Perl memory profiling
Practical SystemTAP basics: Perl memory profilingPractical SystemTAP basics: Perl memory profiling
Practical SystemTAP basics: Perl memory profiling
Lubomir Rintel
 
Python and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthroughPython and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthrough
gabriellekuruvilla
 
3150 Chapter 2 Part 1
3150 Chapter 2 Part 13150 Chapter 2 Part 1
3150 Chapter 2 Part 1Mole Wong
 
10 reasons to be excited about go
10 reasons to be excited about go10 reasons to be excited about go
10 reasons to be excited about go
Dvir Volk
 
Ola Bini J Ruby Power On The Jvm
Ola Bini J Ruby Power On The JvmOla Bini J Ruby Power On The Jvm
Ola Bini J Ruby Power On The Jvmdeimos
 
J Ruby Power On The Jvm
J Ruby Power On The JvmJ Ruby Power On The Jvm
J Ruby Power On The JvmQConLondon2008
 
Hack Like It's 2013 (The Workshop)
Hack Like It's 2013 (The Workshop)Hack Like It's 2013 (The Workshop)
Hack Like It's 2013 (The Workshop)
Itzik Kotler
 
Creating a reasonable project boilerplate
Creating a reasonable project boilerplateCreating a reasonable project boilerplate
Creating a reasonable project boilerplate
Stanislav Petrov
 
Not Your Fathers C - C Application Development In 2016
Not Your Fathers C - C Application Development In 2016Not Your Fathers C - C Application Development In 2016
Not Your Fathers C - C Application Development In 2016
maiktoepfer
 
Introduction to Go for Java Developers
Introduction to Go for Java DevelopersIntroduction to Go for Java Developers
Introduction to Go for Java Developers
Laszlo Csontos
 
Coroutines in Kotlin
Coroutines in KotlinCoroutines in Kotlin
Coroutines in Kotlin
Jemo Mgebrishvili
 
Python Introduction
Python IntroductionPython Introduction
Python Introduction
Learnbay Datascience
 
Python tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academyPython tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academy
TIB Academy
 
C tutorial
C tutorialC tutorial
C tutorial
Diwakar_singh1989
 
Introduction Of C++
Introduction Of C++Introduction Of C++
Introduction Of C++
Sangharsh agarwal
 
Number of Computer Languages = 3
Number of Computer Languages = 3Number of Computer Languages = 3
Number of Computer Languages = 3
Ram Sekhar
 

Similar to Jython: Integrating Python and Java (20)

AOT-compilation of JavaScript with V8
AOT-compilation of JavaScript with V8AOT-compilation of JavaScript with V8
AOT-compilation of JavaScript with V8
 
C Language
C LanguageC Language
C Language
 
Practical SystemTAP basics: Perl memory profiling
Practical SystemTAP basics: Perl memory profilingPractical SystemTAP basics: Perl memory profiling
Practical SystemTAP basics: Perl memory profiling
 
Python and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthroughPython and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthrough
 
3150 Chapter 2 Part 1
3150 Chapter 2 Part 13150 Chapter 2 Part 1
3150 Chapter 2 Part 1
 
10 reasons to be excited about go
10 reasons to be excited about go10 reasons to be excited about go
10 reasons to be excited about go
 
Ola Bini J Ruby Power On The Jvm
Ola Bini J Ruby Power On The JvmOla Bini J Ruby Power On The Jvm
Ola Bini J Ruby Power On The Jvm
 
J Ruby Power On The Jvm
J Ruby Power On The JvmJ Ruby Power On The Jvm
J Ruby Power On The Jvm
 
Hack Like It's 2013 (The Workshop)
Hack Like It's 2013 (The Workshop)Hack Like It's 2013 (The Workshop)
Hack Like It's 2013 (The Workshop)
 
Os Lattner
Os LattnerOs Lattner
Os Lattner
 
Creating a reasonable project boilerplate
Creating a reasonable project boilerplateCreating a reasonable project boilerplate
Creating a reasonable project boilerplate
 
Not Your Fathers C - C Application Development In 2016
Not Your Fathers C - C Application Development In 2016Not Your Fathers C - C Application Development In 2016
Not Your Fathers C - C Application Development In 2016
 
Introduction to Go for Java Developers
Introduction to Go for Java DevelopersIntroduction to Go for Java Developers
Introduction to Go for Java Developers
 
C tutorial
C tutorialC tutorial
C tutorial
 
Coroutines in Kotlin
Coroutines in KotlinCoroutines in Kotlin
Coroutines in Kotlin
 
Python Introduction
Python IntroductionPython Introduction
Python Introduction
 
Python tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academyPython tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academy
 
C tutorial
C tutorialC tutorial
C tutorial
 
Introduction Of C++
Introduction Of C++Introduction Of C++
Introduction Of C++
 
Number of Computer Languages = 3
Number of Computer Languages = 3Number of Computer Languages = 3
Number of Computer Languages = 3
 

More from Charles Anderson

Modern php
Modern phpModern php
Modern php
Charles Anderson
 
Literate Programming
Literate ProgrammingLiterate Programming
Literate Programming
Charles Anderson
 
Inrastructure as Code
Inrastructure as CodeInrastructure as Code
Inrastructure as Code
Charles Anderson
 
How to get a Software Job w/o Experience
How to get a Software Job w/o ExperienceHow to get a Software Job w/o Experience
How to get a Software Job w/o Experience
Charles Anderson
 
Docker - Hack Salem! - November 2014
Docker - Hack Salem! - November 2014Docker - Hack Salem! - November 2014
Docker - Hack Salem! - November 2014
Charles Anderson
 
A Brief Introduction to Redis
A Brief Introduction to RedisA Brief Introduction to Redis
A Brief Introduction to Redis
Charles Anderson
 
A Shallow Survey of Alternative Languages on the JVM
A Shallow Survey of Alternative Languages on the JVMA Shallow Survey of Alternative Languages on the JVM
A Shallow Survey of Alternative Languages on the JVM
Charles Anderson
 
How to Get a Software Job w/o Experience
How to Get a Software Job w/o ExperienceHow to Get a Software Job w/o Experience
How to Get a Software Job w/o Experience
Charles Anderson
 
How To Protect Yourself and Your Computer Online
How To Protect Yourself and Your Computer OnlineHow To Protect Yourself and Your Computer Online
How To Protect Yourself and Your Computer Online
Charles Anderson
 
Groovy a Scripting Language for Java
Groovy a Scripting Language for JavaGroovy a Scripting Language for Java
Groovy a Scripting Language for Java
Charles Anderson
 

More from Charles Anderson (10)

Modern php
Modern phpModern php
Modern php
 
Literate Programming
Literate ProgrammingLiterate Programming
Literate Programming
 
Inrastructure as Code
Inrastructure as CodeInrastructure as Code
Inrastructure as Code
 
How to get a Software Job w/o Experience
How to get a Software Job w/o ExperienceHow to get a Software Job w/o Experience
How to get a Software Job w/o Experience
 
Docker - Hack Salem! - November 2014
Docker - Hack Salem! - November 2014Docker - Hack Salem! - November 2014
Docker - Hack Salem! - November 2014
 
A Brief Introduction to Redis
A Brief Introduction to RedisA Brief Introduction to Redis
A Brief Introduction to Redis
 
A Shallow Survey of Alternative Languages on the JVM
A Shallow Survey of Alternative Languages on the JVMA Shallow Survey of Alternative Languages on the JVM
A Shallow Survey of Alternative Languages on the JVM
 
How to Get a Software Job w/o Experience
How to Get a Software Job w/o ExperienceHow to Get a Software Job w/o Experience
How to Get a Software Job w/o Experience
 
How To Protect Yourself and Your Computer Online
How To Protect Yourself and Your Computer OnlineHow To Protect Yourself and Your Computer Online
How To Protect Yourself and Your Computer Online
 
Groovy a Scripting Language for Java
Groovy a Scripting Language for JavaGroovy a Scripting Language for Java
Groovy a Scripting Language for Java
 

Recently uploaded

Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
ThomasParaiso2
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
Rohit Gautam
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 

Recently uploaded (20)

Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 

Jython: Integrating Python and Java

  • 1. Jython: Integrating Python and Java Charles Anderson Western Skies Consulting Western Oregon University charles@western-skies.us / andersc@wou.edu
  • 2. 10 Second Summary • Jython is the Python interpreter implemented in Java
  • 3. Outline • Python • Scripting and embedded languages • Jython • Other Java scripting languages
  • 4. Python Background • Python is a object-oriented scripting language - runs on many platforms • Mature but still evolving: version 1.0 - 1994, current version: 2.5, 3.0 under development • Huge user base including Google,Yahoo, YouTube, Industrial Light & Magic
  • 5. Python Overview • Python is a scripting language - no compile • Dynamic typing - no variable declarations, but strictly typed at runtime • Simple syntax - large library rather than cryptic syntax (c.f., Perl) • Often a refuge from other languages
  • 6. Hello World • print “hello world” • that’s it - no semicolons, no main function, no curly braces, etc.
  • 7. Language Features • Object oriented: hybrid/not pure, multiple inheritance - c.f., C++ • Polymorphism without inheritance - “duck typing” • Very dynamic - introspection/reflection is simple and powerful - c.f., Java
  • 8. Syntax • Pretty simple - familiar to Java programmers c = sqrt(a*a, b*b) emp = Employee(‘Bob’, ‘Jones’) employees[‘Bob’] = emp import sys, email.mime.text
  • 9. More Syntax if x < 0: print ‘negative’ try: z=y/x except ZeroDivisionError, msg: print msg
  • 10. Class Definition class Point2D: def __init__(self, x, y): self.x = x self.y = y def distance(self): return math.sqrt( self.x**2+self.y**2)
  • 11. Syntax Notes • The block structure of code is determined by indentation - what you see is what the compiler sees • No dangling curly braces • Python favors libraries over fancy, terse syntax - c.f., Perl • When needed, __method__
  • 12. Embedded Languages • TCL was developed to provide a common command language for tools written in C • Adding command line to tools • Extending TCL to add commands from C to TCL • Similar to Unix shell - C functions instead of executable programs
  • 13. Extending TCL • TCL uses a simple interface between TCL and C code: int argc, char** argv • Programmer writes thin layer of interface functions to expose functionality to TCL • Programmer has to choose functions to be exposed • Can be automated - swig
  • 14. Scripting a Program • Do the real work in C (or whatever) and glue it together with TCL • Provides extensibility of C tool to users • Performance of script language doesn’t really matter - Pareto principal • E.g., Numeric Python at LLNL • Can prototype in scripting language
  • 15. Python Interpreter • Python is an interpreted language - need an interpreter to execute Python code • Originally written in C - “CPython” • Code is compiled to byte codes at runtime • Python can be interfaced with existing C code similar to TCL
  • 16. Jython Interpreter • Jython is Python interpreter written in Java • Python code is compiled to Java byte codes • Aside: Iron Python is interpreter written to .Net CLR
  • 17. Jython Ramifications • Interpreter written in Java - so what? • Jython interfaces directly to Java w/o any explicit coding • Uses Java introspection/reflection • All Java classes on class path are immediately available from Python code • Interactive command line for Java
  • 19. Java Python Integration • Python can call Java code • Java code can call out to Python - possibly in a new Python interpreter (sandbox) • Python code can sub-class Java classes
  • 20. Possible Uses • Command prompt for controlling app • Interactive workbench for experimenting • One-off utility work - e.g., data loading • Flexible “business” rules
  • 21. Scripting Java • Groovy - groovy.codehaus.org • JACL (TCL in Java) - tcljava.sourceforge.net • JRuby - jruby.codehaus.org • JSR 223 Scripting the Java Platform - Java 6 SE
  • 22. Jython Information • www.jython.org • There are a couple of Jython books • “Scripting: Higher Level Programming for the 21st Century” - Ousterhout