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

What's hot (20)

Structure in C
Structure in CStructure in C
Structure in C
 
Multiplexer and DeMultiplexer
Multiplexer and DeMultiplexerMultiplexer and DeMultiplexer
Multiplexer and DeMultiplexer
 
Function in c
Function in cFunction in c
Function in c
 
Operators in c programming
Operators in c programmingOperators in c programming
Operators in c programming
 
C formatted and unformatted input and output constructs
C  formatted and unformatted input and output constructsC  formatted and unformatted input and output constructs
C formatted and unformatted input and output constructs
 
Python basic syntax
Python basic syntaxPython basic syntax
Python basic syntax
 
Type conversion
Type  conversionType  conversion
Type conversion
 
Digital electronics logic families
Digital electronics logic familiesDigital electronics logic families
Digital electronics logic families
 
Command line-arguments-in-java-tutorial
Command line-arguments-in-java-tutorialCommand line-arguments-in-java-tutorial
Command line-arguments-in-java-tutorial
 
Recursion in c++
Recursion in c++Recursion in c++
Recursion in c++
 
Lm 35
Lm 35Lm 35
Lm 35
 
Python basics
Python basicsPython basics
Python basics
 
Python introduction
Python introductionPython introduction
Python introduction
 
Pseudocode
PseudocodePseudocode
Pseudocode
 
Pointers in C Programming
Pointers in C ProgrammingPointers in C Programming
Pointers in C Programming
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Command line arguments
Command line argumentsCommand line arguments
Command line arguments
 
Python basic
Python basicPython basic
Python basic
 
Function Generator
Function   GeneratorFunction   Generator
Function Generator
 
Structure of a C program
Structure of a C programStructure of a C program
Structure of a C program
 

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
 
Programming with Python: Week 1
Programming with Python: Week 1Programming with Python: Week 1
Programming with Python: Week 1Ahmet Bulut
 
Programming in python - Week 7,8
Programming in python - Week 7,8Programming in python - Week 7,8
Programming in python - Week 7,8Priya Nayak
 
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 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 Interview Questions For Experienced
Python Interview Questions For ExperiencedPython Interview Questions For Experienced
Python Interview Questions For Experiencedzynofustechnology
 
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
 

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
 
Programming in python - Week 7,8
Programming in python - Week 7,8Programming in python - Week 7,8
Programming in python - Week 7,8
 
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
 

More from NexThoughts Technologies (20)

Alexa skill
Alexa skillAlexa skill
Alexa skill
 
GraalVM
GraalVMGraalVM
GraalVM
 
Docker & kubernetes
Docker & kubernetesDocker & kubernetes
Docker & kubernetes
 
Apache commons
Apache commonsApache commons
Apache commons
 
HazelCast
HazelCastHazelCast
HazelCast
 
MySQL Pro
MySQL ProMySQL Pro
MySQL Pro
 
Microservice Architecture using Spring Boot with React & Redux
Microservice Architecture using Spring Boot with React & ReduxMicroservice Architecture using Spring Boot with React & Redux
Microservice Architecture using Spring Boot with React & Redux
 
Swagger
SwaggerSwagger
Swagger
 
Solid Principles
Solid PrinciplesSolid Principles
Solid Principles
 
Arango DB
Arango DBArango DB
Arango DB
 
Introduction to TypeScript
Introduction to TypeScriptIntroduction to TypeScript
Introduction to TypeScript
 
Smart Contract samples
Smart Contract samplesSmart Contract samples
Smart Contract samples
 
My Doc of geth
My Doc of gethMy Doc of geth
My Doc of geth
 
Geth important commands
Geth important commandsGeth important commands
Geth important commands
 
Ethereum genesis
Ethereum genesisEthereum genesis
Ethereum genesis
 
Ethereum
EthereumEthereum
Ethereum
 
Springboot Microservices
Springboot MicroservicesSpringboot Microservices
Springboot Microservices
 
An Introduction to Redux
An Introduction to ReduxAn Introduction to Redux
An Introduction to Redux
 
Google authentication
Google authenticationGoogle authentication
Google authentication
 
Postgresql
PostgresqlPostgresql
Postgresql
 

Recently uploaded

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
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
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
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
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
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
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
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
 

Recently uploaded (20)

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
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 ...
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
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
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
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
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
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
 

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.