SlideShare a Scribd company logo
1 of 26
Download to read offline
Jython
Python for Java Platform
Agenda
âť– History
âť– Introduction
âť– Installation
âť– Jython Console
âť– Jython Basic Datatypes
âť– Collections
âť– Modules and Importing
âť– Functions
History
It was initially created in late 1997 to replace C with Java for performace
intensive.
It moves to SourceForge in October, 2000.
The Python Software Foundation awarded a grant in January 2005.
Jython 2.5 was released in June 2009
Introduction
â—Ź Python is an easy to learn, powerful programming language.
â—Ź Jython is an implementation of Python for the JVM.
â—Ź It takes the Python programming languages syntax and enables it to run
on the Java Platform.
â—Ź Most of the Python modules will run without changes under Jython, but if
they use extensions then they will probably not work.
Why Jython
1. Embedded Scripting
2. Ability to extend existing Java classes
3. Optional static compilation
4. Bean Properties
5. Python Language
There are certain libraries written in Java languages to be included with Jython
(especially modules written in C).
â—Ź Introduction
â—Ź Built-in Functions
â—Ź Built-in Constants
â—Ź Built-in Objects
â—Ź Built-in Types
â—Ź Built-in Exceptions
â—Ź String Services
â—Ź Data Types
â—Ź Numeric and Mathematical
Modules
â—Ź File and Directory Access
â—Ź Data Persistence
â—Ź Data Compression and
Archiving
â—Ź File Formats
â—Ź Cryptographic Services
â—Ź Generic Operating System
Service
â—Ź Optional Operating System
â—Ź Interprocess Communication
and Networking
â—Ź Many More...
Installation
Download Jython 2.7 and execute below command to start installation GUI.
java -jar jython_installer-2.*.*.jar
We can add --console to start the installation in non GUI.
JYTHON_HOME=/home/vijay/jython2.7.0; export JYTHON_HOME
PATH=$PATH:$JYTHON_HOME/bin
Jython
Jython Basic Data Type
â—Ź It sees everything, including all data and code, as an object.
â—Ź Jython Types Summary
â—Ź Common Operators
â—Ź Boolean Types
â—Ź Numeric Types
â—Ź Additional Methods and Operations
Jython Collections
It supports two major types of collections
1. Sequence Types (Order Collection of items)
2. Map Type
Sequence Types
1. All sequences are zero-indexed. It is similar to C and Java Arrays.
2. All sequences support indexing (or subscripting) to select sub-elements.
3. It support an extension of indexing, called slicing, which selects a range of
elements.
4. It also support reverse slicing.
5. Slicing Reference
6. Sequence Operators
7. Sequence Function
Strings
1. A string is an immutable sequence of characters treated as a value.
2. String Methods
3. It doesn’t have a character type. Character are represented by strings of
length one.
4. Escape Character
5. Format Code
Tuples
1. Tuples are immutable lists of any type.
2. It can be of any length and can contain any type of object.
3. Tuple Example
Ranges
1. Jython uses immutable sequence of increasing integers, called ranges.
2. It can be easily created by
a. range({start}, end,{inc}) creates a small range. All element of the range exist.
b. xrange({start}, end, {inc}) creates a large range. Elements are created only as needed.
3. Default start is 0 and default inc is 1.
Lists
1. Lists Method
2. We can use List as Stack and Queue.
3. Stack is easy to implement using append() and pop().
4. To implement Queue we use collections.queue
5. It can also be created via advance notation, called list comprehensions.
Map and Dictionaries
We work only with subtypes of Map. Most commonly we used dictionary.
Dictionary Example
Modules and Importing
â—Ź Jython breaks program down into separate files, called modules.
â—Ź Jython Modules Library
â—Ź A module is an executable Jython file that contains definitions.
â—Ź Jython packages are implemented as directories that can contain one or
more than one modules and a special file __init__.py, that executed before
first module of the package is executed.
â—Ź import module {as alias} OR from module import name {as alias}
â—Ź From module import *
â—Ź Import is executable
Math Module Examples
Other Important Stuff
Exception
Procedural Statement
Jython Functions
1. Functions
Blocks of code that return values (called functions)
2. Subroutines
Blocks that don’t return values
Functions are declared by def statement.
def name ( args ): statement -- or -- def name ( args ): block
â—Ź Specifying Function Argument
â—Ź Anonymous Function
â—Ź Generic Function
â—Ź Nested Function
â—Ź Functional Programming
Sample Application
References
â—Ź http://imagej.net/Jython_Scripting_Examples
â—Ź https://www.ibm.com/developerworks/java/tutorials/j-jython1/j-jython1.h
tml
â—Ź https://dzone.com/articles/embed-jython-to-your-java-codebase

More Related Content

What's hot

Developing Multithreaded Applications
Developing Multithreaded ApplicationsDeveloping Multithreaded Applications
Developing Multithreaded ApplicationsBharat17485
 
Review of c_sharp2_features_part_iii
Review of c_sharp2_features_part_iiiReview of c_sharp2_features_part_iii
Review of c_sharp2_features_part_iiiNico Ludwig
 
Core java questions
Core java questionsCore java questions
Core java questionsDinesh Reddy G
 
Java Threads and Concurrency
Java Threads and ConcurrencyJava Threads and Concurrency
Java Threads and ConcurrencySunil OS
 
12 multi-threading
12 multi-threading12 multi-threading
12 multi-threadingAPU
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in javaArafat Hossan
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in javajunnubabu
 
Thread model of java
Thread model of javaThread model of java
Thread model of javamyrajendra
 
L22 multi-threading-introduction
L22 multi-threading-introductionL22 multi-threading-introduction
L22 multi-threading-introductionteach4uin
 
Thread model in java
Thread model in javaThread model in java
Thread model in javaAmbigaMurugesan
 
Synchronization.37
Synchronization.37Synchronization.37
Synchronization.37myrajendra
 
Java Interview Questions by NageswaraRao
Java Interview Questions by NageswaraRaoJava Interview Questions by NageswaraRao
Java Interview Questions by NageswaraRaoJavabynataraJ
 
Multithreading In Java
Multithreading In JavaMultithreading In Java
Multithreading In Javaparag
 
Multithread Programing in Java
Multithread Programing in JavaMultithread Programing in Java
Multithread Programing in JavaM. Raihan
 

What's hot (18)

Developing Multithreaded Applications
Developing Multithreaded ApplicationsDeveloping Multithreaded Applications
Developing Multithreaded Applications
 
Review of c_sharp2_features_part_iii
Review of c_sharp2_features_part_iiiReview of c_sharp2_features_part_iii
Review of c_sharp2_features_part_iii
 
Core java questions
Core java questionsCore java questions
Core java questions
 
Java Threads and Concurrency
Java Threads and ConcurrencyJava Threads and Concurrency
Java Threads and Concurrency
 
12 multi-threading
12 multi-threading12 multi-threading
12 multi-threading
 
Java threads
Java threadsJava threads
Java threads
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
 
Threads concept in java
Threads concept in javaThreads concept in java
Threads concept in java
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
 
Thread model of java
Thread model of javaThread model of java
Thread model of java
 
L22 multi-threading-introduction
L22 multi-threading-introductionL22 multi-threading-introduction
L22 multi-threading-introduction
 
Thread model in java
Thread model in javaThread model in java
Thread model in java
 
Synchronization.37
Synchronization.37Synchronization.37
Synchronization.37
 
Java interview questions
Java interview questionsJava interview questions
Java interview questions
 
Java threads
Java threadsJava threads
Java threads
 
Java Interview Questions by NageswaraRao
Java Interview Questions by NageswaraRaoJava Interview Questions by NageswaraRao
Java Interview Questions by NageswaraRao
 
Multithreading In Java
Multithreading In JavaMultithreading In Java
Multithreading In Java
 
Multithread Programing in Java
Multithread Programing in JavaMultithread Programing in Java
Multithread Programing in Java
 

Similar to Jython

python interview prep question , 52 questions
python interview prep question , 52 questionspython interview prep question , 52 questions
python interview prep question , 52 questionsgokul174578
 
Python intro
Python introPython intro
Python introPiyush rai
 
Programming with Python: Week 1
Programming with Python: Week 1Programming with Python: Week 1
Programming with Python: Week 1Ahmet Bulut
 
Python Course In Chandigarh
Python Course In ChandigarhPython Course In Chandigarh
Python Course In ChandigarhExcellence Academy
 
web programming Unit VIII complete about python by Bhavsingh Maloth
web programming Unit VIII complete about python  by Bhavsingh Malothweb programming Unit VIII complete about python  by Bhavsingh Maloth
web programming Unit VIII complete about python by Bhavsingh MalothBhavsingh Maloth
 
Python Demo.pptx
Python Demo.pptxPython Demo.pptx
Python Demo.pptxParveenShaik21
 
Python Mastery: A Comprehensive Guide to Setting Up Your Development Environment
Python Mastery: A Comprehensive Guide to Setting Up Your Development EnvironmentPython Mastery: A Comprehensive Guide to Setting Up Your Development Environment
Python Mastery: A Comprehensive Guide to Setting Up Your Development EnvironmentPython Devloper
 
Python Course In Chandigarh
Python Course In ChandigarhPython Course In Chandigarh
Python Course In ChandigarhExcellence Academy
 
Python Interview Questions For Experienced
Python Interview Questions For ExperiencedPython Interview Questions For Experienced
Python Interview Questions For Experiencedzynofustechnology
 
Functions in Python
Functions in PythonFunctions in Python
Functions in PythonKamal Acharya
 
Python Demo.pptx
Python Demo.pptxPython Demo.pptx
Python Demo.pptxParveenShaik21
 
Introduction to Python programming Language
Introduction to Python programming LanguageIntroduction to Python programming Language
Introduction to Python programming LanguageMansiSuthar3
 
Introduction about Python by JanBask Training
Introduction about Python by JanBask TrainingIntroduction about Python by JanBask Training
Introduction about Python by JanBask TrainingJanBask Training
 
4_Introduction to Python Programming.pptx
4_Introduction to Python Programming.pptx4_Introduction to Python Programming.pptx
4_Introduction to Python Programming.pptxGnanesh12
 
Python for katana
Python for katanaPython for katana
Python for katanakedar nath
 
PYTHON PROGRAMMING NOTES RKREDDY.pdf
PYTHON PROGRAMMING NOTES RKREDDY.pdfPYTHON PROGRAMMING NOTES RKREDDY.pdf
PYTHON PROGRAMMING NOTES RKREDDY.pdfRamakrishna Reddy Bijjam
 

Similar to Jython (20)

python interview prep question , 52 questions
python interview prep question , 52 questionspython interview prep question , 52 questions
python interview prep question , 52 questions
 
Python
PythonPython
Python
 
Python intro
Python introPython intro
Python intro
 
Programming with Python: Week 1
Programming with Python: Week 1Programming with Python: Week 1
Programming with Python: Week 1
 
Modules in Python
Modules in PythonModules in Python
Modules in Python
 
Python Course In Chandigarh
Python Course In ChandigarhPython Course In Chandigarh
Python Course In Chandigarh
 
web programming Unit VIII complete about python by Bhavsingh Maloth
web programming Unit VIII complete about python  by Bhavsingh Malothweb programming Unit VIII complete about python  by Bhavsingh Maloth
web programming Unit VIII complete about python by Bhavsingh Maloth
 
Python Demo.pptx
Python Demo.pptxPython Demo.pptx
Python Demo.pptx
 
Python Mastery: A Comprehensive Guide to Setting Up Your Development Environment
Python Mastery: A Comprehensive Guide to Setting Up Your Development EnvironmentPython Mastery: A Comprehensive Guide to Setting Up Your Development Environment
Python Mastery: A Comprehensive Guide to Setting Up Your Development Environment
 
Python Course In Chandigarh
Python Course In ChandigarhPython Course In Chandigarh
Python Course In Chandigarh
 
Python Interview Questions For Experienced
Python Interview Questions For ExperiencedPython Interview Questions For Experienced
Python Interview Questions For Experienced
 
Functions in Python
Functions in PythonFunctions in Python
Functions in Python
 
Python Demo.pptx
Python Demo.pptxPython Demo.pptx
Python Demo.pptx
 
Java 9 Features
Java 9 FeaturesJava 9 Features
Java 9 Features
 
Introduction to Python programming Language
Introduction to Python programming LanguageIntroduction to Python programming Language
Introduction to Python 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
 
4_Introduction to Python Programming.pptx
4_Introduction to Python Programming.pptx4_Introduction to Python Programming.pptx
4_Introduction to Python Programming.pptx
 
Python for katana
Python for katanaPython for katana
Python for katana
 
PYTHON PROGRAMMING NOTES RKREDDY.pdf
PYTHON PROGRAMMING NOTES RKREDDY.pdfPYTHON PROGRAMMING NOTES RKREDDY.pdf
PYTHON PROGRAMMING NOTES RKREDDY.pdf
 
Pythonpresent
PythonpresentPythonpresent
Pythonpresent
 

More from Vijay Shukla

Introduction of webpack 4
Introduction of webpack 4Introduction of webpack 4
Introduction of webpack 4Vijay Shukla
 
Preview of Groovy 3
Preview of Groovy 3Preview of Groovy 3
Preview of Groovy 3Vijay Shukla
 
Groovy closures
Groovy closuresGroovy closures
Groovy closuresVijay Shukla
 
Grails services
Grails servicesGrails services
Grails servicesVijay Shukla
 
Grails plugin
Grails pluginGrails plugin
Grails pluginVijay Shukla
 
Grails domain
Grails domainGrails domain
Grails domainVijay Shukla
 
Grails custom tag lib
Grails custom tag libGrails custom tag lib
Grails custom tag libVijay Shukla
 
Config BuildConfig
Config BuildConfigConfig BuildConfig
Config BuildConfigVijay Shukla
 
Command object
Command objectCommand object
Command objectVijay Shukla
 
Boot strap.groovy
Boot strap.groovyBoot strap.groovy
Boot strap.groovyVijay Shukla
 
Custom plugin
Custom pluginCustom plugin
Custom pluginVijay Shukla
 
Spring security
Spring securitySpring security
Spring securityVijay Shukla
 
Config/BuildConfig
Config/BuildConfigConfig/BuildConfig
Config/BuildConfigVijay Shukla
 

More from Vijay Shukla (20)

Introduction of webpack 4
Introduction of webpack 4Introduction of webpack 4
Introduction of webpack 4
 
Preview of Groovy 3
Preview of Groovy 3Preview of Groovy 3
Preview of Groovy 3
 
Groovy closures
Groovy closuresGroovy closures
Groovy closures
 
Groovy
GroovyGroovy
Groovy
 
Grails services
Grails servicesGrails services
Grails services
 
Grails plugin
Grails pluginGrails plugin
Grails plugin
 
Grails domain
Grails domainGrails domain
Grails domain
 
Grails custom tag lib
Grails custom tag libGrails custom tag lib
Grails custom tag lib
 
Grails
GrailsGrails
Grails
 
Gorm
GormGorm
Gorm
 
Controller
ControllerController
Controller
 
Config BuildConfig
Config BuildConfigConfig BuildConfig
Config BuildConfig
 
Command object
Command objectCommand object
Command object
 
Boot strap.groovy
Boot strap.groovyBoot strap.groovy
Boot strap.groovy
 
Vertx
VertxVertx
Vertx
 
Custom plugin
Custom pluginCustom plugin
Custom plugin
 
Spring security
Spring securitySpring security
Spring security
 
REST
RESTREST
REST
 
Config/BuildConfig
Config/BuildConfigConfig/BuildConfig
Config/BuildConfig
 
GORM
GORMGORM
GORM
 

Recently uploaded

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 

Recently uploaded (20)

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 

Jython

  • 2. Agenda âť– History âť– Introduction âť– Installation âť– Jython Console âť– Jython Basic Datatypes âť– Collections âť– Modules and Importing âť– Functions
  • 3. History It was initially created in late 1997 to replace C with Java for performace intensive. It moves to SourceForge in October, 2000. The Python Software Foundation awarded a grant in January 2005. Jython 2.5 was released in June 2009
  • 4. Introduction â—Ź Python is an easy to learn, powerful programming language. â—Ź Jython is an implementation of Python for the JVM. â—Ź It takes the Python programming languages syntax and enables it to run on the Java Platform. â—Ź Most of the Python modules will run without changes under Jython, but if they use extensions then they will probably not work.
  • 5. Why Jython 1. Embedded Scripting 2. Ability to extend existing Java classes 3. Optional static compilation 4. Bean Properties 5. Python Language
  • 6. There are certain libraries written in Java languages to be included with Jython (especially modules written in C). â—Ź Introduction â—Ź Built-in Functions â—Ź Built-in Constants â—Ź Built-in Objects â—Ź Built-in Types â—Ź Built-in Exceptions â—Ź String Services â—Ź Data Types â—Ź Numeric and Mathematical Modules â—Ź File and Directory Access â—Ź Data Persistence â—Ź Data Compression and Archiving â—Ź File Formats â—Ź Cryptographic Services â—Ź Generic Operating System Service â—Ź Optional Operating System â—Ź Interprocess Communication and Networking â—Ź Many More...
  • 7. Installation Download Jython 2.7 and execute below command to start installation GUI. java -jar jython_installer-2.*.*.jar We can add --console to start the installation in non GUI. JYTHON_HOME=/home/vijay/jython2.7.0; export JYTHON_HOME PATH=$PATH:$JYTHON_HOME/bin
  • 9.
  • 10. Jython Basic Data Type â—Ź It sees everything, including all data and code, as an object. â—Ź Jython Types Summary â—Ź Common Operators â—Ź Boolean Types â—Ź Numeric Types â—Ź Additional Methods and Operations
  • 11. Jython Collections It supports two major types of collections 1. Sequence Types (Order Collection of items) 2. Map Type
  • 12. Sequence Types 1. All sequences are zero-indexed. It is similar to C and Java Arrays. 2. All sequences support indexing (or subscripting) to select sub-elements. 3. It support an extension of indexing, called slicing, which selects a range of elements. 4. It also support reverse slicing. 5. Slicing Reference 6. Sequence Operators 7. Sequence Function
  • 13. Strings 1. A string is an immutable sequence of characters treated as a value. 2. String Methods 3. It doesn’t have a character type. Character are represented by strings of length one. 4. Escape Character 5. Format Code
  • 14. Tuples 1. Tuples are immutable lists of any type. 2. It can be of any length and can contain any type of object. 3. Tuple Example
  • 15. Ranges 1. Jython uses immutable sequence of increasing integers, called ranges. 2. It can be easily created by a. range({start}, end,{inc}) creates a small range. All element of the range exist. b. xrange({start}, end, {inc}) creates a large range. Elements are created only as needed. 3. Default start is 0 and default inc is 1.
  • 16. Lists 1. Lists Method 2. We can use List as Stack and Queue. 3. Stack is easy to implement using append() and pop(). 4. To implement Queue we use collections.queue 5. It can also be created via advance notation, called list comprehensions.
  • 17. Map and Dictionaries We work only with subtypes of Map. Most commonly we used dictionary. Dictionary Example
  • 18.
  • 19. Modules and Importing â—Ź Jython breaks program down into separate files, called modules. â—Ź Jython Modules Library â—Ź A module is an executable Jython file that contains definitions. â—Ź Jython packages are implemented as directories that can contain one or more than one modules and a special file __init__.py, that executed before first module of the package is executed. â—Ź import module {as alias} OR from module import name {as alias} â—Ź From module import * â—Ź Import is executable
  • 22. Jython Functions 1. Functions Blocks of code that return values (called functions) 2. Subroutines Blocks that don’t return values Functions are declared by def statement. def name ( args ): statement -- or -- def name ( args ): block
  • 23. â—Ź Specifying Function Argument â—Ź Anonymous Function â—Ź Generic Function â—Ź Nested Function â—Ź Functional Programming
  • 25.