The document discusses Python, including:
- The Python project was initiated by Guido van Rossum in 1990 and has emerged as an open infrastructure for development including mailing lists, PEPs, and the PSF.
- Python has multiple implementations including the standard CPython in C, Jython for Java, IronPython for .NET, and experimental versions like PyPy and Stackless Python.
- The session aims to introduce the Python project, key aspects of the Python language, and the Python programming style.
Quick introduction to Python for Pace University undergraduate students. Includes an intro to Jupyter Notebook, the Python libraries scikit-learn and pandas.
** Python Certification Training: https://www.edureka.co/python **
This Edureka PPT on 'Introduction To Python' will help you establish a strong hold on all the fundamentals in the Python programming language. Below are the topics covered in this PPT:
Introduction To Python
Keywords And Identifiers
Variables And Data Types
Operators
Loops In Python
Functions
Classes And Objects
OOPS Concepts
File Handling
YouTube Video: https://youtu.be/uYjRzbP5aZs
Python Tutorial Playlist: https://goo.gl/WsBpKe
Blog Series: http://bit.ly/2sqmP4s
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Quick introduction to Python for Pace University undergraduate students. Includes an intro to Jupyter Notebook, the Python libraries scikit-learn and pandas.
** Python Certification Training: https://www.edureka.co/python **
This Edureka PPT on 'Introduction To Python' will help you establish a strong hold on all the fundamentals in the Python programming language. Below are the topics covered in this PPT:
Introduction To Python
Keywords And Identifiers
Variables And Data Types
Operators
Loops In Python
Functions
Classes And Objects
OOPS Concepts
File Handling
YouTube Video: https://youtu.be/uYjRzbP5aZs
Python Tutorial Playlist: https://goo.gl/WsBpKe
Blog Series: http://bit.ly/2sqmP4s
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
** Python Certification Training: https://www.edureka.co/python **
This Edureka PPT on Python Projects will help you establish a foothold on Python by helping you assess and obtain skills which are used to design, develop and analyze projects built in Python.
1. Introduction to Python
2. Installation and Working with Python
3. Python Projects- 3levels
4. Practical approach - Code
Python Tutorial Playlist: https://goo.gl/WsBpKe
Blog Series: http://bit.ly/2sqmP4s
Follow us to never miss an update in the future:
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
The following PPT is an Introduction to Python as a Programming Language and its Applications. It covers all the basic info about python and its applications. This is an interactive presentation created using PowerPoint Online.
Python is a widely-used and powerful computer programming language that has helped system administrators manage computer networks and problem solve computer systems for decades. Python has also built some popular applications like BitTorrent, Blender, Calibre, Dropbox, and much more. Going further, the “Pi” in Raspberry Pi stands for Python, so learning Python will instill more confidence when working with Raspberry Pi projects. Python is usually the first programming language people learn primarily because it is easy to learn and provides a solid foundation to learn other computer programming languages. In this webinar,
• Learn what Python is and what it is capable of doing.
• Install Python’s IDE for Windows and work in the Python shell.
• Use calculations, variables, strings, lists, and if statements.
• Discover Python’s built-in functions and understand modules.
• Create simple programs to build on later.
The recording is available at https://youtu.be/ThcWmJFf-ho.
Introduction to python -easiest way to understand python for beginners
What is Python…?
Differences between programming and scripting language
Programming Paradigms
History of Python
Scope of Python
Why do people use Python?
Installing Python
How to download and install Python - lesson 2Shohel Rana
We will follow some steps to complete the installation process of Python.
1. Download the Python installer from Python website.
2. By double clicking install it.
3. Set the path for Python
4. Check Python is working very well.
5. If you missed the path setting for Python, then uninstall it and re install Python.
Python Foundation – A programmer's introduction to Python concepts & styleKevlin Henney
This is a two-day course in Python programming aimed at professional programmers. The course material provided here is intended to be used by teachers of the language, but individual learners might find some of this useful as well.
The course assume the students already know some Python, but that they feel a need to establish a solid understanding of the language to further develop their skills.
The course is released under Creative Commons Attribution 4.0. Its primary location (along with some sample solutions and the original PowerPoint) is at https://github.com/JonJagger/two-day-courses/tree/master/pf
Python programming | Fundamentals of Python programming KrishnaMildain
Basic Fundamentals of Python Programming.
What is Python, History of python, Advantages, Disadvantages, feature of python, scope, and many more.
Data Structure using Python, Object Oriented Programming using
This presentation educates you about Python and the reason for learning python, Key advantages of learning Python, Characteristics of Python, Hello World using Python syntax and Applications of Python.
For more topics stay tuned with Learnbay.
Introduction to Python programming LanguageMansiSuthar3
This presentation give basic information about the python language,its data types,operators,code blocks,functions,packages,file handling ,classes and also its syntax with examples. It also include some basic information Numpy and various plotting.
Python An Introduction, A presentation Developed by Swarit Wadhe. This Slide Will Give you basic information about python (Origin, Codes and difference from other languages).
I hope you'll find this helpfull and if you do please share it with your fellows.
Python, the Language of Science and Engineering for EngineersBoey Pak Cheong
A talk given in November 2016 at IEM Malaysia to engineers, who are new to Python, a broad perspective of what Python is, why it is important to learn it and how it can help in solving/visualization of engineering and scientific tasks and problems.
** Python Certification Training: https://www.edureka.co/python **
This Edureka PPT on Python Projects will help you establish a foothold on Python by helping you assess and obtain skills which are used to design, develop and analyze projects built in Python.
1. Introduction to Python
2. Installation and Working with Python
3. Python Projects- 3levels
4. Practical approach - Code
Python Tutorial Playlist: https://goo.gl/WsBpKe
Blog Series: http://bit.ly/2sqmP4s
Follow us to never miss an update in the future:
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
The following PPT is an Introduction to Python as a Programming Language and its Applications. It covers all the basic info about python and its applications. This is an interactive presentation created using PowerPoint Online.
Python is a widely-used and powerful computer programming language that has helped system administrators manage computer networks and problem solve computer systems for decades. Python has also built some popular applications like BitTorrent, Blender, Calibre, Dropbox, and much more. Going further, the “Pi” in Raspberry Pi stands for Python, so learning Python will instill more confidence when working with Raspberry Pi projects. Python is usually the first programming language people learn primarily because it is easy to learn and provides a solid foundation to learn other computer programming languages. In this webinar,
• Learn what Python is and what it is capable of doing.
• Install Python’s IDE for Windows and work in the Python shell.
• Use calculations, variables, strings, lists, and if statements.
• Discover Python’s built-in functions and understand modules.
• Create simple programs to build on later.
The recording is available at https://youtu.be/ThcWmJFf-ho.
Introduction to python -easiest way to understand python for beginners
What is Python…?
Differences between programming and scripting language
Programming Paradigms
History of Python
Scope of Python
Why do people use Python?
Installing Python
How to download and install Python - lesson 2Shohel Rana
We will follow some steps to complete the installation process of Python.
1. Download the Python installer from Python website.
2. By double clicking install it.
3. Set the path for Python
4. Check Python is working very well.
5. If you missed the path setting for Python, then uninstall it and re install Python.
Python Foundation – A programmer's introduction to Python concepts & styleKevlin Henney
This is a two-day course in Python programming aimed at professional programmers. The course material provided here is intended to be used by teachers of the language, but individual learners might find some of this useful as well.
The course assume the students already know some Python, but that they feel a need to establish a solid understanding of the language to further develop their skills.
The course is released under Creative Commons Attribution 4.0. Its primary location (along with some sample solutions and the original PowerPoint) is at https://github.com/JonJagger/two-day-courses/tree/master/pf
Python programming | Fundamentals of Python programming KrishnaMildain
Basic Fundamentals of Python Programming.
What is Python, History of python, Advantages, Disadvantages, feature of python, scope, and many more.
Data Structure using Python, Object Oriented Programming using
This presentation educates you about Python and the reason for learning python, Key advantages of learning Python, Characteristics of Python, Hello World using Python syntax and Applications of Python.
For more topics stay tuned with Learnbay.
Introduction to Python programming LanguageMansiSuthar3
This presentation give basic information about the python language,its data types,operators,code blocks,functions,packages,file handling ,classes and also its syntax with examples. It also include some basic information Numpy and various plotting.
Python An Introduction, A presentation Developed by Swarit Wadhe. This Slide Will Give you basic information about python (Origin, Codes and difference from other languages).
I hope you'll find this helpfull and if you do please share it with your fellows.
Python, the Language of Science and Engineering for EngineersBoey Pak Cheong
A talk given in November 2016 at IEM Malaysia to engineers, who are new to Python, a broad perspective of what Python is, why it is important to learn it and how it can help in solving/visualization of engineering and scientific tasks and problems.
Common MS Excel and MS Excel 2013 useful tricks. By Ashot EngibaryanAshot Engibaryan
On the 9-th of November 2013 I held a master class concerning MS Excel 2013 useful tricks. The participants learnt about the solutions of widespread problems, faced in Excel environment. They also learnt about the new reporting tools and features, the full package of which is reachable only in Excel 2013. Implementation of these tools can substantially enhance the overall working efficiency in Excel.
While the Java platform has gained notoriety in the last 15 years as a robust application platform with a thriving ecosystem and well-established practices, the Java language has had its share of criticism. Highly verbose, overly didactic, limited feature set; whichever flavor of criticism you prefer, it's patently obvious that Java is playing catch up to more modern languages with a less rigid evolution path.
The language landscape today is vastly different than it had been five or ten years ago; a wide array of languages are available, designed to suit a variety of flavors: Groovy, Clojure, Scala, Gosu, Kotlin... which should you choose? This lecture focuses on one company's decision to focus on Scala, and presents a case study based on our experiences using Scala in practice, in the hope of providing much-needed real world context to assist your decision.
This presentation was used for the Scala In Practice lecture at the Botzia Israeli Java User Group meeting, May 3rd 2012.
Excel Excellence (Microsoft Excel training that "sticks"): FormulasLaura Winger
Microsoft Excel is one of the most powerful tools, and if you use Excel on a regular basis for your job, chances are you are under utilizing it and could increase your productivity and free up hours each week with improved Excel skills. My Excel Excellence courses provide hands-on experience with realistic business examples and simplified explanations. Become a whiz at VLookUp's, PivotTables, and even program your own Macros! This slide deck is a preview from my first session on Formulas. Formulas are used for more than math, they can be used for re-formatting data, extracting data and putting data together (“concatenating”). Learn how to harness the power of Excel and put the computer to work for you!
Scala - The Simple Parts, SFScala presentationMartin Odersky
These are the slides of the talk I gave on May 22, 2014 to the San Francisco Scala user group. Similar talks were given before at GOTO Chicago, keynote, at Gilt Groupe and Hunter College in New York, at JAX Mainz and at FlatMap Oslo.
SEE MORE, INCLUDING A FREE TRIAL, AT: www.PivotTable-Pro.com
This video shows basic worksheet elements and navigation in Excel.
Free Excel Training Course: http://www.SpreadsheetTrainer.com
Contents:
***The Excel Worksheet ***
What is a cell?
What is a row?
What is a column?
***Selecting & Navigating***
What is the selected cell?
How to select a cell in the Excel worksheet
How to use the GoTo function
How to navigate with page up & page down,
How to navigate with Alt+page up & Alt+page down,
Navigating with Ctrl+arrow, Home, & Ctrl+Home
***Ranges***
What is a range?
How to select a range with the mouse and keyboard
How to select a range with Ctrl+Shift+Arrow
What is the active cell?
How to select nonadjacent cells.
Referring to range addresses.
Given on Tuesday, June 23, 2009 at the Greater Cleveland PC Users Group C#/VB.NET SIG. A very basic intro to Python given to a .NET crowd with the assumption of little to no Python experience.
Tweepy is an open source Python package that gives you a very convenient way to access the Twitter API with Python. Tweepy includes a set of classes and methods that represent Twitter's models and API endpoints, and it transparently handles various implementation details, such as: Data encoding and decoding.
Python is a high-level language programming, interpreted, interactive and object-oriented scripting language. Python is designed to be highly readable.
A very basic, high-level presentation on why one should start learning Python today.
Presented at the Bukidnon State University extension campus at Alubijid National Comprehensive High School, Alubijid, Misamis Oriental, Philippines.
Python is an interpreted, object oriented , high level programming language with dynamic semantics. It provides instructions to teach the computer how to perform a task.
Python is one of the most powerful programming languages out there due to its versatility and the prevalence of libraries to achieve all sorts of interesting things.
It offers efficient high-level data structures and an object-oriented programming style that is simple yet effective. A high-grade language is a computer programming language that is meant to represent the needs of a problem and mimics natural language or mathematical notation.
Python supports multiple programming paradigms, including object-oriented, imperative and functional programming or procedural styles. It features a dynamic type system and automatic memory management and has a large and comprehensive standard library.
A slightly modified version of original "An introduction to Python
for absolute beginners" slides. For credits please check the second page. I used this presentation for my school's internal Python course. thank you forviewing
Python is a high-level, interpreted, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation. Python is dynamically-typed and garbage-collected..
In this PPT I have described all about python like :- What is Python, History, Versions, Features, Advantages, Disadvantages, Career opportunities, Training and certifications.
Similar to Python: the Project, the Language and the Style (20)
Acetabularia Information For Class 9 .docxvaibhavrinwa19
Acetabularia acetabulum is a single-celled green alga that in its vegetative state is morphologically differentiated into a basal rhizoid and an axially elongated stalk, which bears whorls of branching hairs. The single diploid nucleus resides in the rhizoid.
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
Normal Labour/ Stages of Labour/ Mechanism of LabourWasim Ak
Normal labor is also termed spontaneous labor, defined as the natural physiological process through which the fetus, placenta, and membranes are expelled from the uterus through the birth canal at term (37 to 42 weeks
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
Macroeconomics- Movie Location
This will be used as part of your Personal Professional Portfolio once graded.
Objective:
Prepare a presentation or a paper using research, basic comparative analysis, data organization and application of economic information. You will make an informed assessment of an economic climate outside of the United States to accomplish an entertainment industry objective.
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
1. Python: the Project, the Language and the Style
Juan Manuel Gimeno Illa
jmgimeno@diei.udl.cat
October 2008
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 1 / 28
2. Outline
1 Introduction
2 Python, the project
3 Python, the language
References
Functions
Modules and Packages
Namespaces and Scopes
4 Python, the style
5 Hands on Work
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 2 / 28
3. Introduction
What this session pretends
A very light introduction to the making of Python (the project)
A presentation of some aspects of Python (the language)
We will focus on those elements and concepts that are most shocking
for people coming from C, C++, Java, . . .
A basic knowledge of the language is assumed (a casual reading the
Python Tutorial is enough)
We will begin to get into what me might call the python style of
doing things (the style)
(In the live session we will also present the interpreter (python), an
enhanced interpreter (ipython) and the default integrated
development environment (idle) among other things)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 3 / 28
4. Introduction
What this session pretends
A very light introduction to the making of Python (the project)
A presentation of some aspects of Python (the language)
We will focus on those elements and concepts that are most shocking
for people coming from C, C++, Java, . . .
A basic knowledge of the language is assumed (a casual reading the
Python Tutorial is enough)
We will begin to get into what me might call the python style of
doing things (the style)
(In the live session we will also present the interpreter (python), an
enhanced interpreter (ipython) and the default integrated
development environment (idle) among other things)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 3 / 28
5. Introduction
What this session pretends
A very light introduction to the making of Python (the project)
A presentation of some aspects of Python (the language)
We will focus on those elements and concepts that are most shocking
for people coming from C, C++, Java, . . .
A basic knowledge of the language is assumed (a casual reading the
Python Tutorial is enough)
We will begin to get into what me might call the python style of
doing things (the style)
(In the live session we will also present the interpreter (python), an
enhanced interpreter (ipython) and the default integrated
development environment (idle) among other things)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 3 / 28
6. Introduction
What this session pretends
A very light introduction to the making of Python (the project)
A presentation of some aspects of Python (the language)
We will focus on those elements and concepts that are most shocking
for people coming from C, C++, Java, . . .
A basic knowledge of the language is assumed (a casual reading the
Python Tutorial is enough)
We will begin to get into what me might call the python style of
doing things (the style)
(In the live session we will also present the interpreter (python), an
enhanced interpreter (ipython) and the default integrated
development environment (idle) among other things)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 3 / 28
7. Introduction
What this session pretends
A very light introduction to the making of Python (the project)
A presentation of some aspects of Python (the language)
We will focus on those elements and concepts that are most shocking
for people coming from C, C++, Java, . . .
A basic knowledge of the language is assumed (a casual reading the
Python Tutorial is enough)
We will begin to get into what me might call the python style of
doing things (the style)
(In the live session we will also present the interpreter (python), an
enhanced interpreter (ipython) and the default integrated
development environment (idle) among other things)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 3 / 28
8. Introduction
What this session pretends
A very light introduction to the making of Python (the project)
A presentation of some aspects of Python (the language)
We will focus on those elements and concepts that are most shocking
for people coming from C, C++, Java, . . .
A basic knowledge of the language is assumed (a casual reading the
Python Tutorial is enough)
We will begin to get into what me might call the python style of
doing things (the style)
(In the live session we will also present the interpreter (python), an
enhanced interpreter (ipython) and the default integrated
development environment (idle) among other things)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 3 / 28
9. Python, the project
Organization
Initiated by Guido van Rossum (BDFL: Benevolent Dictator For Life)
in 1990 and made public in 1991
By the years, a process and an infrastructure for the development of
Python have emerged:
SourceForge: patches, bugs, etc.
Mailing lists: python-dev, python-list
Newsgroup: comp.lang.python
PEPs: Python Enhancement Proposals
SIGs: Special Interest Groups
PSF: Python Software Foundation holds the copyright of
Python since version 2.1
All of this is accessible from http://python.org
Its a very open project provided you follow some rules!!
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 4 / 28
10. Python, the project
Organization
Initiated by Guido van Rossum (BDFL: Benevolent Dictator For Life)
in 1990 and made public in 1991
By the years, a process and an infrastructure for the development of
Python have emerged:
SourceForge: patches, bugs, etc.
Mailing lists: python-dev, python-list
Newsgroup: comp.lang.python
PEPs: Python Enhancement Proposals
SIGs: Special Interest Groups
PSF: Python Software Foundation holds the copyright of
Python since version 2.1
All of this is accessible from http://python.org
Its a very open project provided you follow some rules!!
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 4 / 28
11. Python, the project
Organization
Initiated by Guido van Rossum (BDFL: Benevolent Dictator For Life)
in 1990 and made public in 1991
By the years, a process and an infrastructure for the development of
Python have emerged:
SourceForge: patches, bugs, etc.
Mailing lists: python-dev, python-list
Newsgroup: comp.lang.python
PEPs: Python Enhancement Proposals
SIGs: Special Interest Groups
PSF: Python Software Foundation holds the copyright of
Python since version 2.1
All of this is accessible from http://python.org
Its a very open project provided you follow some rules!!
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 4 / 28
12. Python, the project
Organization
Initiated by Guido van Rossum (BDFL: Benevolent Dictator For Life)
in 1990 and made public in 1991
By the years, a process and an infrastructure for the development of
Python have emerged:
SourceForge: patches, bugs, etc.
Mailing lists: python-dev, python-list
Newsgroup: comp.lang.python
PEPs: Python Enhancement Proposals
SIGs: Special Interest Groups
PSF: Python Software Foundation holds the copyright of
Python since version 2.1
All of this is accessible from http://python.org
Its a very open project provided you follow some rules!!
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 4 / 28
13. Python, the project
Organization
Initiated by Guido van Rossum (BDFL: Benevolent Dictator For Life)
in 1990 and made public in 1991
By the years, a process and an infrastructure for the development of
Python have emerged:
SourceForge: patches, bugs, etc.
Mailing lists: python-dev, python-list
Newsgroup: comp.lang.python
PEPs: Python Enhancement Proposals
SIGs: Special Interest Groups
PSF: Python Software Foundation holds the copyright of
Python since version 2.1
All of this is accessible from http://python.org
Its a very open project provided you follow some rules!!
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 4 / 28
14. Python, the project
Organization
Initiated by Guido van Rossum (BDFL: Benevolent Dictator For Life)
in 1990 and made public in 1991
By the years, a process and an infrastructure for the development of
Python have emerged:
SourceForge: patches, bugs, etc.
Mailing lists: python-dev, python-list
Newsgroup: comp.lang.python
PEPs: Python Enhancement Proposals
SIGs: Special Interest Groups
PSF: Python Software Foundation holds the copyright of
Python since version 2.1
All of this is accessible from http://python.org
Its a very open project provided you follow some rules!!
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 4 / 28
15. Python, the project
Organization
Initiated by Guido van Rossum (BDFL: Benevolent Dictator For Life)
in 1990 and made public in 1991
By the years, a process and an infrastructure for the development of
Python have emerged:
SourceForge: patches, bugs, etc.
Mailing lists: python-dev, python-list
Newsgroup: comp.lang.python
PEPs: Python Enhancement Proposals
SIGs: Special Interest Groups
PSF: Python Software Foundation holds the copyright of
Python since version 2.1
All of this is accessible from http://python.org
Its a very open project provided you follow some rules!!
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 4 / 28
16. Python, the project
Organization
Initiated by Guido van Rossum (BDFL: Benevolent Dictator For Life)
in 1990 and made public in 1991
By the years, a process and an infrastructure for the development of
Python have emerged:
SourceForge: patches, bugs, etc.
Mailing lists: python-dev, python-list
Newsgroup: comp.lang.python
PEPs: Python Enhancement Proposals
SIGs: Special Interest Groups
PSF: Python Software Foundation holds the copyright of
Python since version 2.1
All of this is accessible from http://python.org
Its a very open project provided you follow some rules!!
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 4 / 28
17. Python, the project
Organization
Initiated by Guido van Rossum (BDFL: Benevolent Dictator For Life)
in 1990 and made public in 1991
By the years, a process and an infrastructure for the development of
Python have emerged:
SourceForge: patches, bugs, etc.
Mailing lists: python-dev, python-list
Newsgroup: comp.lang.python
PEPs: Python Enhancement Proposals
SIGs: Special Interest Groups
PSF: Python Software Foundation holds the copyright of
Python since version 2.1
All of this is accessible from http://python.org
Its a very open project provided you follow some rules!!
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 4 / 28
18. Python, the project
Organization
Initiated by Guido van Rossum (BDFL: Benevolent Dictator For Life)
in 1990 and made public in 1991
By the years, a process and an infrastructure for the development of
Python have emerged:
SourceForge: patches, bugs, etc.
Mailing lists: python-dev, python-list
Newsgroup: comp.lang.python
PEPs: Python Enhancement Proposals
SIGs: Special Interest Groups
PSF: Python Software Foundation holds the copyright of
Python since version 2.1
All of this is accessible from http://python.org
Its a very open project provided you follow some rules!!
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 4 / 28
19. Python, the project
Implementations
The language Python has different implementations
CPython: Standard implementation of the python language in C.
Currently at version 2.6 of the language
Jython: Java implementation that compiles python code to JVM
byte-code
Currently at version 2.2.1 of the language (alpha version
2.5a3)
IronPython: .NET implementation that compiles python code to CLR
Currently at version 2.4 of the language (with minor
differences)
Stackless: enhanced version using micro-threads, implemented in C
Currently at version 2.6 of the language
PyPy: Rather experimental version of python written in python
Python 3000: (or py3k) non-backwards compatible evolution of CPython
We will use CPython versions 2.4 (very little differences)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 5 / 28
20. Python, the project
Implementations
The language Python has different implementations
CPython: Standard implementation of the python language in C.
Currently at version 2.6 of the language
Jython: Java implementation that compiles python code to JVM
byte-code
Currently at version 2.2.1 of the language (alpha version
2.5a3)
IronPython: .NET implementation that compiles python code to CLR
Currently at version 2.4 of the language (with minor
differences)
Stackless: enhanced version using micro-threads, implemented in C
Currently at version 2.6 of the language
PyPy: Rather experimental version of python written in python
Python 3000: (or py3k) non-backwards compatible evolution of CPython
We will use CPython versions 2.4 (very little differences)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 5 / 28
21. Python, the project
Implementations
The language Python has different implementations
CPython: Standard implementation of the python language in C.
Currently at version 2.6 of the language
Jython: Java implementation that compiles python code to JVM
byte-code
Currently at version 2.2.1 of the language (alpha version
2.5a3)
IronPython: .NET implementation that compiles python code to CLR
Currently at version 2.4 of the language (with minor
differences)
Stackless: enhanced version using micro-threads, implemented in C
Currently at version 2.6 of the language
PyPy: Rather experimental version of python written in python
Python 3000: (or py3k) non-backwards compatible evolution of CPython
We will use CPython versions 2.4 (very little differences)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 5 / 28
22. Python, the project
Implementations
The language Python has different implementations
CPython: Standard implementation of the python language in C.
Currently at version 2.6 of the language
Jython: Java implementation that compiles python code to JVM
byte-code
Currently at version 2.2.1 of the language (alpha version
2.5a3)
IronPython: .NET implementation that compiles python code to CLR
Currently at version 2.4 of the language (with minor
differences)
Stackless: enhanced version using micro-threads, implemented in C
Currently at version 2.6 of the language
PyPy: Rather experimental version of python written in python
Python 3000: (or py3k) non-backwards compatible evolution of CPython
We will use CPython versions 2.4 (very little differences)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 5 / 28
23. Python, the project
Implementations
The language Python has different implementations
CPython: Standard implementation of the python language in C.
Currently at version 2.6 of the language
Jython: Java implementation that compiles python code to JVM
byte-code
Currently at version 2.2.1 of the language (alpha version
2.5a3)
IronPython: .NET implementation that compiles python code to CLR
Currently at version 2.4 of the language (with minor
differences)
Stackless: enhanced version using micro-threads, implemented in C
Currently at version 2.6 of the language
PyPy: Rather experimental version of python written in python
Python 3000: (or py3k) non-backwards compatible evolution of CPython
We will use CPython versions 2.4 (very little differences)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 5 / 28
24. Python, the project
Implementations
The language Python has different implementations
CPython: Standard implementation of the python language in C.
Currently at version 2.6 of the language
Jython: Java implementation that compiles python code to JVM
byte-code
Currently at version 2.2.1 of the language (alpha version
2.5a3)
IronPython: .NET implementation that compiles python code to CLR
Currently at version 2.4 of the language (with minor
differences)
Stackless: enhanced version using micro-threads, implemented in C
Currently at version 2.6 of the language
PyPy: Rather experimental version of python written in python
Python 3000: (or py3k) non-backwards compatible evolution of CPython
We will use CPython versions 2.4 (very little differences)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 5 / 28
25. Python, the project
Implementations
The language Python has different implementations
CPython: Standard implementation of the python language in C.
Currently at version 2.6 of the language
Jython: Java implementation that compiles python code to JVM
byte-code
Currently at version 2.2.1 of the language (alpha version
2.5a3)
IronPython: .NET implementation that compiles python code to CLR
Currently at version 2.4 of the language (with minor
differences)
Stackless: enhanced version using micro-threads, implemented in C
Currently at version 2.6 of the language
PyPy: Rather experimental version of python written in python
Python 3000: (or py3k) non-backwards compatible evolution of CPython
We will use CPython versions 2.4 (very little differences)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 5 / 28
26. Python, the project
Implementations
The language Python has different implementations
CPython: Standard implementation of the python language in C.
Currently at version 2.6 of the language
Jython: Java implementation that compiles python code to JVM
byte-code
Currently at version 2.2.1 of the language (alpha version
2.5a3)
IronPython: .NET implementation that compiles python code to CLR
Currently at version 2.4 of the language (with minor
differences)
Stackless: enhanced version using micro-threads, implemented in C
Currently at version 2.6 of the language
PyPy: Rather experimental version of python written in python
Python 3000: (or py3k) non-backwards compatible evolution of CPython
We will use CPython versions 2.4 (very little differences)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 5 / 28
27. Python, the project
Implementations
The language Python has different implementations
CPython: Standard implementation of the python language in C.
Currently at version 2.6 of the language
Jython: Java implementation that compiles python code to JVM
byte-code
Currently at version 2.2.1 of the language (alpha version
2.5a3)
IronPython: .NET implementation that compiles python code to CLR
Currently at version 2.4 of the language (with minor
differences)
Stackless: enhanced version using micro-threads, implemented in C
Currently at version 2.6 of the language
PyPy: Rather experimental version of python written in python
Python 3000: (or py3k) non-backwards compatible evolution of CPython
We will use CPython versions 2.4 (very little differences)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 5 / 28
28. Python, the language References
Variables and References
A Python program access data values through references
A reference is a name that refers to the location in memory of a value
(object)
(Python classes, functions and methods are also objects)
References takes the form of variables (x), attributes (x.y) and items
(x[y])
A reference has no intrinsic type but gets the type of the referenced
object (duck typing)
The process of linking a reference to a value is called binding
References can be rebound to another object
Statements that create/modify bindings are assignment, def, class
and import
The del statement unbinds the reference (does not deletes the
object)
Bindings live in name-spaces (more on this later)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 6 / 28
29. Python, the language References
Variables and References
A Python program access data values through references
A reference is a name that refers to the location in memory of a value
(object)
(Python classes, functions and methods are also objects)
References takes the form of variables (x), attributes (x.y) and items
(x[y])
A reference has no intrinsic type but gets the type of the referenced
object (duck typing)
The process of linking a reference to a value is called binding
References can be rebound to another object
Statements that create/modify bindings are assignment, def, class
and import
The del statement unbinds the reference (does not deletes the
object)
Bindings live in name-spaces (more on this later)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 6 / 28
30. Python, the language References
Variables and References
A Python program access data values through references
A reference is a name that refers to the location in memory of a value
(object)
(Python classes, functions and methods are also objects)
References takes the form of variables (x), attributes (x.y) and items
(x[y])
A reference has no intrinsic type but gets the type of the referenced
object (duck typing)
The process of linking a reference to a value is called binding
References can be rebound to another object
Statements that create/modify bindings are assignment, def, class
and import
The del statement unbinds the reference (does not deletes the
object)
Bindings live in name-spaces (more on this later)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 6 / 28
31. Python, the language References
Variables and References
A Python program access data values through references
A reference is a name that refers to the location in memory of a value
(object)
(Python classes, functions and methods are also objects)
References takes the form of variables (x), attributes (x.y) and items
(x[y])
A reference has no intrinsic type but gets the type of the referenced
object (duck typing)
The process of linking a reference to a value is called binding
References can be rebound to another object
Statements that create/modify bindings are assignment, def, class
and import
The del statement unbinds the reference (does not deletes the
object)
Bindings live in name-spaces (more on this later)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 6 / 28
32. Python, the language References
Variables and References
A Python program access data values through references
A reference is a name that refers to the location in memory of a value
(object)
(Python classes, functions and methods are also objects)
References takes the form of variables (x), attributes (x.y) and items
(x[y])
A reference has no intrinsic type but gets the type of the referenced
object (duck typing)
The process of linking a reference to a value is called binding
References can be rebound to another object
Statements that create/modify bindings are assignment, def, class
and import
The del statement unbinds the reference (does not deletes the
object)
Bindings live in name-spaces (more on this later)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 6 / 28
33. Python, the language References
Variables and References
A Python program access data values through references
A reference is a name that refers to the location in memory of a value
(object)
(Python classes, functions and methods are also objects)
References takes the form of variables (x), attributes (x.y) and items
(x[y])
A reference has no intrinsic type but gets the type of the referenced
object (duck typing)
The process of linking a reference to a value is called binding
References can be rebound to another object
Statements that create/modify bindings are assignment, def, class
and import
The del statement unbinds the reference (does not deletes the
object)
Bindings live in name-spaces (more on this later)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 6 / 28
34. Python, the language References
Variables and References
A Python program access data values through references
A reference is a name that refers to the location in memory of a value
(object)
(Python classes, functions and methods are also objects)
References takes the form of variables (x), attributes (x.y) and items
(x[y])
A reference has no intrinsic type but gets the type of the referenced
object (duck typing)
The process of linking a reference to a value is called binding
References can be rebound to another object
Statements that create/modify bindings are assignment, def, class
and import
The del statement unbinds the reference (does not deletes the
object)
Bindings live in name-spaces (more on this later)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 6 / 28
35. Python, the language References
Variables and References
A Python program access data values through references
A reference is a name that refers to the location in memory of a value
(object)
(Python classes, functions and methods are also objects)
References takes the form of variables (x), attributes (x.y) and items
(x[y])
A reference has no intrinsic type but gets the type of the referenced
object (duck typing)
The process of linking a reference to a value is called binding
References can be rebound to another object
Statements that create/modify bindings are assignment, def, class
and import
The del statement unbinds the reference (does not deletes the
object)
Bindings live in name-spaces (more on this later)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 6 / 28
36. Python, the language References
Variables and References
A Python program access data values through references
A reference is a name that refers to the location in memory of a value
(object)
(Python classes, functions and methods are also objects)
References takes the form of variables (x), attributes (x.y) and items
(x[y])
A reference has no intrinsic type but gets the type of the referenced
object (duck typing)
The process of linking a reference to a value is called binding
References can be rebound to another object
Statements that create/modify bindings are assignment, def, class
and import
The del statement unbinds the reference (does not deletes the
object)
Bindings live in name-spaces (more on this later)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 6 / 28
37. Python, the language References
Variables and References
A Python program access data values through references
A reference is a name that refers to the location in memory of a value
(object)
(Python classes, functions and methods are also objects)
References takes the form of variables (x), attributes (x.y) and items
(x[y])
A reference has no intrinsic type but gets the type of the referenced
object (duck typing)
The process of linking a reference to a value is called binding
References can be rebound to another object
Statements that create/modify bindings are assignment, def, class
and import
The del statement unbinds the reference (does not deletes the
object)
Bindings live in name-spaces (more on this later)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 6 / 28
38. Python, the language References
Binding, Rebinding and Unbinding
>>> l = []
>>> id(l)
-1210453844
l gets bound though assignment to a list
(id returns the identity of an object)
l maintains its identity through method
application
But gets rebound with assignment
In this case, augmented assignment does
not rebind
del statement unbinds the reference (it
does not delete objects!!)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 7 / 28
39. Python, the language References
Binding, Rebinding and Unbinding
>>> l = []
>>> id(l)
-1210453844
>>> l.append(1)
l gets bound though assignment to a list >>> id(l)
(id returns the identity of an object) -1210453844
l maintains its identity through method
application
But gets rebound with assignment
In this case, augmented assignment does
not rebind
del statement unbinds the reference (it
does not delete objects!!)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 7 / 28
40. Python, the language References
Binding, Rebinding and Unbinding
>>> l = []
>>> id(l)
-1210453844
>>> l.append(1)
l gets bound though assignment to a list >>> id(l)
(id returns the identity of an object) -1210453844
l maintains its identity through method >>> l = l + [2]
application >>> id(l)
But gets rebound with assignment -1210467412
In this case, augmented assignment does
not rebind
del statement unbinds the reference (it
does not delete objects!!)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 7 / 28
41. Python, the language References
Binding, Rebinding and Unbinding
>>> l = []
>>> id(l)
-1210453844
>>> l.append(1)
l gets bound though assignment to a list >>> id(l)
(id returns the identity of an object) -1210453844
l maintains its identity through method >>> l = l + [2]
application >>> id(l)
But gets rebound with assignment -1210467412
In this case, augmented assignment does >>> l += [3]
not rebind >>> id(l)
del statement unbinds the reference (it -1210467412
does not delete objects!!)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 7 / 28
42. Python, the language References
Binding, Rebinding and Unbinding
>>> l = []
>>> id(l)
-1210453844
>>> l.append(1)
l gets bound though assignment to a list >>> id(l)
(id returns the identity of an object) -1210453844
l maintains its identity through method >>> l = l + [2]
application >>> id(l)
But gets rebound with assignment -1210467412
In this case, augmented assignment does >>> l += [3]
not rebind >>> id(l)
del statement unbinds the reference (it -1210467412
does not delete objects!!) >>> del l
>>> id(l)
Traceback (most recent call last):
File ’<stdin>’, line 1, in ?
NameError: name ’l’ is not defined
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 7 / 28
43. Python, the language Functions
The def statement
def function-name(mandatory, optional=expression):
statement(s)
Formal parameters can be
Mandatory Each call must supply a value for the parameter
Optional If the call does not supply a value, the default is used
The def statement evaluates the expression and saves a reference to
the expression value (the default value of the parameter) among the
attributes of the function object
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 8 / 28
44. Python, the language Functions
The def statement
def function-name(mandatory, optional=expression):
statement(s)
Formal parameters can be
Mandatory Each call must supply a value for the parameter
Optional If the call does not supply a value, the default is used
The def statement evaluates the expression and saves a reference to
the expression value (the default value of the parameter) among the
attributes of the function object
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 8 / 28
45. Python, the language Functions
The def statement
def function-name(mandatory, optional=expression):
statement(s)
Formal parameters can be
Mandatory Each call must supply a value for the parameter
Optional If the call does not supply a value, the default is used
The def statement evaluates the expression and saves a reference to
the expression value (the default value of the parameter) among the
attributes of the function object
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 8 / 28
46. Python, the language Functions
The def statement
def function-name(mandatory, optional=expression):
statement(s)
Formal parameters can be
Mandatory Each call must supply a value for the parameter
Optional If the call does not supply a value, the default is used
The def statement evaluates the expression and saves a reference to
the expression value (the default value of the parameter) among the
attributes of the function object
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 8 / 28
47. Python, the language Functions
The def statement
def function-name(mandatory, optional=expression):
statement(s)
Formal parameters can be
Mandatory Each call must supply a value for the parameter
Optional If the call does not supply a value, the default is used
The def statement evaluates the expression and saves a reference to
the expression value (the default value of the parameter) among the
attributes of the function object
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 8 / 28
48. Python, the language Functions
Evaluation of the defaults
The default expression is not evaluated when the function gets called.
>>> def f(x, y=None):
>>> def f(x, y=[]):
... if y is None: y = []
... y.append(x)
... y.append(x)
... return y
... return y
...
...
>>> print f(23)
>>> print f(23)
[23]
[23]
>>> print f(42)
>>> print f(42)
[23, 42]
[42]
The y=None idiom is the standard way to deal with mutable defaults.
Problem: Do you find another solution in this case?
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 9 / 28
49. Python, the language Functions
Evaluation of the defaults
The default expression is not evaluated when the function gets called.
>>> def f(x, y=None):
>>> def f(x, y=[]):
... if y is None: y = []
... y.append(x)
... y.append(x)
... return y
... return y
...
...
>>> print f(23)
>>> print f(23)
[23]
[23]
>>> print f(42)
>>> print f(42)
[23, 42]
[42]
The y=None idiom is the standard way to deal with mutable defaults.
Problem: Do you find another solution in this case?
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 9 / 28
50. Python, the language Functions
Evaluation of the defaults
The default expression is not evaluated when the function gets called.
>>> def f(x, y=None):
>>> def f(x, y=[]):
... if y is None: y = []
... y.append(x)
... y.append(x)
... return y
... return y
...
...
>>> print f(23)
>>> print f(23)
[23]
[23]
>>> print f(42)
>>> print f(42)
[23, 42]
[42]
The y=None idiom is the standard way to deal with mutable defaults.
Problem: Do you find another solution in this case?
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 9 / 28
51. Python, the language Functions
Evaluation of the defaults
The default expression is not evaluated when the function gets called.
>>> def f(x, y=None):
>>> def f(x, y=[]):
... if y is None: y = []
... y.append(x)
... y.append(x)
... return y
... return y
...
...
>>> print f(23)
>>> print f(23)
[23]
[23]
>>> print f(42)
>>> print f(42)
[23, 42]
[42]
The y=None idiom is the standard way to deal with mutable defaults.
Problem: Do you find another solution in this case?
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 9 / 28
52. Python, the language Functions
Evaluation of the defaults
The default expression is not evaluated when the function gets called.
>>> def f(x, y=None):
>>> def f(x, y=[]):
... if y is None: y = []
... y.append(x)
... y.append(x)
... return y
... return y
...
...
>>> print f(23)
>>> print f(23)
[23]
[23]
>>> print f(42)
>>> print f(42)
[23, 42]
[42]
The y=None idiom is the standard way to deal with mutable defaults.
Problem: Do you find another solution in this case?
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 9 / 28
53. Python, the language Functions
Evaluation of the defaults
The default expression is not evaluated when the function gets called.
>>> def f(x, y=None):
>>> def f(x, y=[]):
... if y is None: y = []
... y.append(x)
... y.append(x)
... return y
... return y
...
...
>>> print f(23)
>>> print f(23)
[23]
[23]
>>> print f(42)
>>> print f(42)
[23, 42]
[42]
The y=None idiom is the standard way to deal with mutable defaults.
Problem: Do you find another solution in this case?
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 9 / 28
54. Python, the language Functions
Extra Positional Arguments
At the end of the arguments list you may optionally add the special
form *args
This binds args to a tuple containing the extra values passed in the
function call
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 10 / 28
55. Python, the language Functions
Extra Positional Arguments
At the end of the arguments list you may optionally add the special
form *args
This binds args to a tuple containing the extra values passed in the
function call
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 10 / 28
56. Python, the language Functions
Extra Positional Arguments
At the end of the arguments list you may optionally add the special
form *args
This binds args to a tuple containing the extra values passed in the
function call
>>> def spam(a, b, *args):
... print a, b, args
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 10 / 28
57. Python, the language Functions
Extra Positional Arguments
At the end of the arguments list you may optionally add the special
form *args
This binds args to a tuple containing the extra values passed in the
function call
>>> def spam(a, b, *args):
... print a, b, args
>>> spam(1, 2)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 10 / 28
58. Python, the language Functions
Extra Positional Arguments
At the end of the arguments list you may optionally add the special
form *args
This binds args to a tuple containing the extra values passed in the
function call
>>> def spam(a, b, *args):
... print a, b, args
>>> spam(1, 2)
1 2 ()
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 10 / 28
59. Python, the language Functions
Extra Positional Arguments
At the end of the arguments list you may optionally add the special
form *args
This binds args to a tuple containing the extra values passed in the
function call
>>> def spam(a, b, *args):
... print a, b, args
>>> spam(1, 2)
1 2 ()
>>> spam(b=1, a=2)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 10 / 28
60. Python, the language Functions
Extra Positional Arguments
At the end of the arguments list you may optionally add the special
form *args
This binds args to a tuple containing the extra values passed in the
function call
>>> def spam(a, b, *args):
... print a, b, args
>>> spam(1, 2)
1 2 ()
>>> spam(b=1, a=2)
2 1 ()
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 10 / 28
61. Python, the language Functions
Extra Positional Arguments
At the end of the arguments list you may optionally add the special
form *args
This binds args to a tuple containing the extra values passed in the
function call
>>> def spam(a, b, *args):
... print a, b, args
>>> spam(1, 2)
1 2 ()
>>> spam(b=1, a=2)
2 1 ()
>>> spam(1, 2, 3, 4, 5)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 10 / 28
62. Python, the language Functions
Extra Positional Arguments
At the end of the arguments list you may optionally add the special
form *args
This binds args to a tuple containing the extra values passed in the
function call
>>> def spam(a, b, *args):
... print a, b, args
>>> spam(1, 2)
1 2 ()
>>> spam(b=1, a=2)
2 1 ()
>>> spam(1, 2, 3, 4, 5)
1 2 (3, 4, 5)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 10 / 28
63. Python, the language Functions
Extra Positional Arguments
At the end of the arguments list you may optionally add the special
form *args
This binds args to a tuple containing the extra values passed in the
function call
>>> def spam(a, b, *args): >>> def eggs(a, *args):
... print a, b, args ... spam(a, args)
>>> spam(1, 2)
1 2 ()
>>> spam(b=1, a=2)
2 1 ()
>>> spam(1, 2, 3, 4, 5)
1 2 (3, 4, 5)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 10 / 28
64. Python, the language Functions
Extra Positional Arguments
At the end of the arguments list you may optionally add the special
form *args
This binds args to a tuple containing the extra values passed in the
function call
>>> def spam(a, b, *args): >>> def eggs(a, *args):
... print a, b, args ... spam(a, args)
>>> spam(1, 2) >>> eggs(1, 2, 3, 4, 5)
1 2 ()
>>> spam(b=1, a=2)
2 1 ()
>>> spam(1, 2, 3, 4, 5)
1 2 (3, 4, 5)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 10 / 28
65. Python, the language Functions
Extra Positional Arguments
At the end of the arguments list you may optionally add the special
form *args
This binds args to a tuple containing the extra values passed in the
function call
>>> def spam(a, b, *args): >>> def eggs(a, *args):
... print a, b, args ... spam(a, args)
>>> spam(1, 2) >>> eggs(1, 2, 3, 4, 5)
1 2 () 1 (2, 3, 4, 5) ()
>>> spam(b=1, a=2)
2 1 ()
>>> spam(1, 2, 3, 4, 5)
1 2 (3, 4, 5)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 10 / 28
66. Python, the language Functions
Extra Positional Arguments
At the end of the arguments list you may optionally add the special
form *args
This binds args to a tuple containing the extra values passed in the
function call
>>> def spam(a, b, *args): >>> def eggs(a, *args):
... print a, b, args ... spam(a, args)
>>> spam(1, 2) >>> eggs(1, 2, 3, 4, 5)
1 2 () 1 (2, 3, 4, 5) ()
>>> spam(b=1, a=2) >>> def ham(a, *args):
2 1 () ... spam(a, *args)
>>> spam(1, 2, 3, 4, 5)
1 2 (3, 4, 5)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 10 / 28
67. Python, the language Functions
Extra Positional Arguments
At the end of the arguments list you may optionally add the special
form *args
This binds args to a tuple containing the extra values passed in the
function call
>>> def spam(a, b, *args): >>> def eggs(a, *args):
... print a, b, args ... spam(a, args)
>>> spam(1, 2) >>> eggs(1, 2, 3, 4, 5)
1 2 () 1 (2, 3, 4, 5) ()
>>> spam(b=1, a=2) >>> def ham(a, *args):
2 1 () ... spam(a, *args)
>>> spam(1, 2, 3, 4, 5) >>> ham(1, 2, 3, 4, 5)
1 2 (3, 4, 5)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 10 / 28
68. Python, the language Functions
Extra Positional Arguments
At the end of the arguments list you may optionally add the special
form *args
This binds args to a tuple containing the extra values passed in the
function call
>>> def spam(a, b, *args): >>> def eggs(a, *args):
... print a, b, args ... spam(a, args)
>>> spam(1, 2) >>> eggs(1, 2, 3, 4, 5)
1 2 () 1 (2, 3, 4, 5) ()
>>> spam(b=1, a=2) >>> def ham(a, *args):
2 1 () ... spam(a, *args)
>>> spam(1, 2, 3, 4, 5) >>> ham(1, 2, 3, 4, 5)
1 2 (3, 4, 5) 1 2 (3, 4, 5)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 10 / 28
69. Python, the language Functions
Extra Named Arguments
At the end of the arguments list you may optionally add the special
from **kwargs
This binds kwargs to a dictionary containing the extra values passed
in the function call and their names
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 11 / 28
70. Python, the language Functions
Extra Named Arguments
At the end of the arguments list you may optionally add the special
from **kwargs
This binds kwargs to a dictionary containing the extra values passed
in the function call and their names
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 11 / 28
71. Python, the language Functions
Extra Named Arguments
At the end of the arguments list you may optionally add the special
from **kwargs
This binds kwargs to a dictionary containing the extra values passed
in the function call and their names
>>> def spam(a, b, **kw):
... print a, b, kw
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 11 / 28
72. Python, the language Functions
Extra Named Arguments
At the end of the arguments list you may optionally add the special
from **kwargs
This binds kwargs to a dictionary containing the extra values passed
in the function call and their names
>>> def spam(a, b, **kw):
... print a, b, kw
>>> spam(1, 2)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 11 / 28
73. Python, the language Functions
Extra Named Arguments
At the end of the arguments list you may optionally add the special
from **kwargs
This binds kwargs to a dictionary containing the extra values passed
in the function call and their names
>>> def spam(a, b, **kw):
... print a, b, kw
>>> spam(1, 2)
1 2 {}
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 11 / 28
74. Python, the language Functions
Extra Named Arguments
At the end of the arguments list you may optionally add the special
from **kwargs
This binds kwargs to a dictionary containing the extra values passed
in the function call and their names
>>> def spam(a, b, **kw):
... print a, b, kw
>>> spam(1, 2)
1 2 {}
>>> spam(b=1, a=2, c=3, d=4)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 11 / 28
75. Python, the language Functions
Extra Named Arguments
At the end of the arguments list you may optionally add the special
from **kwargs
This binds kwargs to a dictionary containing the extra values passed
in the function call and their names
>>> def spam(a, b, **kw):
... print a, b, kw
>>> spam(1, 2)
1 2 {}
>>> spam(b=1, a=2, c=3, d=4)
2 1 {’c’: 3, ’d’: 4}
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 11 / 28
76. Python, the language Functions
Extra Named Arguments
At the end of the arguments list you may optionally add the special
from **kwargs
This binds kwargs to a dictionary containing the extra values passed
in the function call and their names
>>> def spam(a, b, **kw):
... print a, b, kw
>>> spam(1, 2)
1 2 {}
>>> spam(b=1, a=2, c=3, d=4)
2 1 {’c’: 3, ’d’: 4}
>>> def eggs(a, *args, **kw):
... print a, args, kw
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 11 / 28
77. Python, the language Functions
Extra Named Arguments
At the end of the arguments list you may optionally add the special
from **kwargs
This binds kwargs to a dictionary containing the extra values passed
in the function call and their names
>>> def spam(a, b, **kw):
... print a, b, kw
>>> spam(1, 2)
1 2 {}
>>> spam(b=1, a=2, c=3, d=4)
2 1 {’c’: 3, ’d’: 4}
>>> def eggs(a, *args, **kw):
... print a, args, kw
>>> eggs(1,2,3,4)
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 11 / 28
78. Python, the language Functions
Extra Named Arguments
At the end of the arguments list you may optionally add the special
from **kwargs
This binds kwargs to a dictionary containing the extra values passed
in the function call and their names
>>> def spam(a, b, **kw):
... print a, b, kw
>>> spam(1, 2)
1 2 {}
>>> spam(b=1, a=2, c=3, d=4)
2 1 {’c’: 3, ’d’: 4}
>>> def eggs(a, *args, **kw):
... print a, args, kw
>>> eggs(1,2,3,4)
1 (2, 3, 4) {}
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 11 / 28
79. Python, the language Functions
Extra Named Arguments
At the end of the arguments list you may optionally add the special
from **kwargs
This binds kwargs to a dictionary containing the extra values passed
in the function call and their names
>>> def spam(a, b, **kw): >>> def ham(a,**kw):
... print a, b, kw ... spam(a, kw)
>>> spam(1, 2)
1 2 {}
>>> spam(b=1, a=2, c=3, d=4)
2 1 {’c’: 3, ’d’: 4}
>>> def eggs(a, *args, **kw):
... print a, args, kw
>>> eggs(1,2,3,4)
1 (2, 3, 4) {}
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 11 / 28
80. Python, the language Functions
Extra Named Arguments
At the end of the arguments list you may optionally add the special
from **kwargs
This binds kwargs to a dictionary containing the extra values passed
in the function call and their names
>>> def spam(a, b, **kw): >>> def ham(a,**kw):
... print a, b, kw ... spam(a, kw)
>>> spam(1, 2) >>> ham(1, b=2, c=3)
1 2 {}
>>> spam(b=1, a=2, c=3, d=4)
2 1 {’c’: 3, ’d’: 4}
>>> def eggs(a, *args, **kw):
... print a, args, kw
>>> eggs(1,2,3,4)
1 (2, 3, 4) {}
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 11 / 28
81. Python, the language Functions
Extra Named Arguments
At the end of the arguments list you may optionally add the special
from **kwargs
This binds kwargs to a dictionary containing the extra values passed
in the function call and their names
>>> def spam(a, b, **kw): >>> def ham(a,**kw):
... print a, b, kw ... spam(a, kw)
>>> spam(1, 2) >>> ham(1, b=2, c=3)
1 2 {} 1 {’c’: 3, ’b’: 2} {}
>>> spam(b=1, a=2, c=3, d=4)
2 1 {’c’: 3, ’d’: 4}
>>> def eggs(a, *args, **kw):
... print a, args, kw
>>> eggs(1,2,3,4)
1 (2, 3, 4) {}
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 11 / 28
82. Python, the language Functions
Extra Named Arguments
At the end of the arguments list you may optionally add the special
from **kwargs
This binds kwargs to a dictionary containing the extra values passed
in the function call and their names
>>> def spam(a, b, **kw): >>> def ham(a,**kw):
... print a, b, kw ... spam(a, kw)
>>> spam(1, 2) >>> ham(1, b=2, c=3)
1 2 {} 1 {’c’: 3, ’b’: 2} {}
>>> spam(b=1, a=2, c=3, d=4) >>> def pram(a,**kw):
2 1 {’c’: 3, ’d’: 4} ... spam(a, **kw)
>>> def eggs(a, *args, **kw):
... print a, args, kw
>>> eggs(1,2,3,4)
1 (2, 3, 4) {}
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 11 / 28
83. Python, the language Functions
Extra Named Arguments
At the end of the arguments list you may optionally add the special
from **kwargs
This binds kwargs to a dictionary containing the extra values passed
in the function call and their names
>>> def spam(a, b, **kw): >>> def ham(a,**kw):
... print a, b, kw ... spam(a, kw)
>>> spam(1, 2) >>> ham(1, b=2, c=3)
1 2 {} 1 {’c’: 3, ’b’: 2} {}
>>> spam(b=1, a=2, c=3, d=4) >>> def pram(a,**kw):
2 1 {’c’: 3, ’d’: 4} ... spam(a, **kw)
>>> def eggs(a, *args, **kw): >>> pram(1, b=2, c=3)
... print a, args, kw
>>> eggs(1,2,3,4)
1 (2, 3, 4) {}
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 11 / 28
84. Python, the language Functions
Extra Named Arguments
At the end of the arguments list you may optionally add the special
from **kwargs
This binds kwargs to a dictionary containing the extra values passed
in the function call and their names
>>> def spam(a, b, **kw): >>> def ham(a,**kw):
... print a, b, kw ... spam(a, kw)
>>> spam(1, 2) >>> ham(1, b=2, c=3)
1 2 {} 1 {’c’: 3, ’b’: 2} {}
>>> spam(b=1, a=2, c=3, d=4) >>> def pram(a,**kw):
2 1 {’c’: 3, ’d’: 4} ... spam(a, **kw)
>>> def eggs(a, *args, **kw): >>> pram(1, b=2, c=3)
... print a, args, kw 1 2 {’c’: 3}
>>> eggs(1,2,3,4)
1 (2, 3, 4) {}
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 11 / 28
85. Python, the language Modules and Packages
Modules
A typical Python program is made up of several source files
Each source file corresponds to a module that groups variables,
functions, classes, etc. for reuse
A module explicitly establishes its dependencies using the import and
from statements
In some languages global variables provide a hidden mechanism for
coupling between modules
In Python global variables are not global to all modules: they are
attributes of a module object (module.variable)
Extensions, components coded in other languages such as C, C++,
Java, C#, are treated as modules by the python code
In Python everything is defined in a module:
main program or interactive sessions in module main
built-ins in preloaded module builtin accessible via import
builtin
at loading, modules get an extra attribute named builtins which
refers to either to module builtin or to its dictionary
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 12 / 28
86. Python, the language Modules and Packages
Modules
A typical Python program is made up of several source files
Each source file corresponds to a module that groups variables,
functions, classes, etc. for reuse
A module explicitly establishes its dependencies using the import and
from statements
In some languages global variables provide a hidden mechanism for
coupling between modules
In Python global variables are not global to all modules: they are
attributes of a module object (module.variable)
Extensions, components coded in other languages such as C, C++,
Java, C#, are treated as modules by the python code
In Python everything is defined in a module:
main program or interactive sessions in module main
built-ins in preloaded module builtin accessible via import
builtin
at loading, modules get an extra attribute named builtins which
refers to either to module builtin or to its dictionary
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 12 / 28
87. Python, the language Modules and Packages
Modules
A typical Python program is made up of several source files
Each source file corresponds to a module that groups variables,
functions, classes, etc. for reuse
A module explicitly establishes its dependencies using the import and
from statements
In some languages global variables provide a hidden mechanism for
coupling between modules
In Python global variables are not global to all modules: they are
attributes of a module object (module.variable)
Extensions, components coded in other languages such as C, C++,
Java, C#, are treated as modules by the python code
In Python everything is defined in a module:
main program or interactive sessions in module main
built-ins in preloaded module builtin accessible via import
builtin
at loading, modules get an extra attribute named builtins which
refers to either to module builtin or to its dictionary
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 12 / 28
88. Python, the language Modules and Packages
Modules
A typical Python program is made up of several source files
Each source file corresponds to a module that groups variables,
functions, classes, etc. for reuse
A module explicitly establishes its dependencies using the import and
from statements
In some languages global variables provide a hidden mechanism for
coupling between modules
In Python global variables are not global to all modules: they are
attributes of a module object (module.variable)
Extensions, components coded in other languages such as C, C++,
Java, C#, are treated as modules by the python code
In Python everything is defined in a module:
main program or interactive sessions in module main
built-ins in preloaded module builtin accessible via import
builtin
at loading, modules get an extra attribute named builtins which
refers to either to module builtin or to its dictionary
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 12 / 28
89. Python, the language Modules and Packages
Modules
A typical Python program is made up of several source files
Each source file corresponds to a module that groups variables,
functions, classes, etc. for reuse
A module explicitly establishes its dependencies using the import and
from statements
In some languages global variables provide a hidden mechanism for
coupling between modules
In Python global variables are not global to all modules: they are
attributes of a module object (module.variable)
Extensions, components coded in other languages such as C, C++,
Java, C#, are treated as modules by the python code
In Python everything is defined in a module:
main program or interactive sessions in module main
built-ins in preloaded module builtin accessible via import
builtin
at loading, modules get an extra attribute named builtins which
refers to either to module builtin or to its dictionary
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 12 / 28
90. Python, the language Modules and Packages
Modules
A typical Python program is made up of several source files
Each source file corresponds to a module that groups variables,
functions, classes, etc. for reuse
A module explicitly establishes its dependencies using the import and
from statements
In some languages global variables provide a hidden mechanism for
coupling between modules
In Python global variables are not global to all modules: they are
attributes of a module object (module.variable)
Extensions, components coded in other languages such as C, C++,
Java, C#, are treated as modules by the python code
In Python everything is defined in a module:
main program or interactive sessions in module main
built-ins in preloaded module builtin accessible via import
builtin
at loading, modules get an extra attribute named builtins which
refers to either to module builtin or to its dictionary
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 12 / 28
91. Python, the language Modules and Packages
Modules
A typical Python program is made up of several source files
Each source file corresponds to a module that groups variables,
functions, classes, etc. for reuse
A module explicitly establishes its dependencies using the import and
from statements
In some languages global variables provide a hidden mechanism for
coupling between modules
In Python global variables are not global to all modules: they are
attributes of a module object (module.variable)
Extensions, components coded in other languages such as C, C++,
Java, C#, are treated as modules by the python code
In Python everything is defined in a module:
main program or interactive sessions in module main
built-ins in preloaded module builtin accessible via import
builtin
at loading, modules get an extra attribute named builtins which
refers to either to module builtin or to its dictionary
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 12 / 28
92. Python, the language Modules and Packages
Modules
A typical Python program is made up of several source files
Each source file corresponds to a module that groups variables,
functions, classes, etc. for reuse
A module explicitly establishes its dependencies using the import and
from statements
In some languages global variables provide a hidden mechanism for
coupling between modules
In Python global variables are not global to all modules: they are
attributes of a module object (module.variable)
Extensions, components coded in other languages such as C, C++,
Java, C#, are treated as modules by the python code
In Python everything is defined in a module:
main program or interactive sessions in module main
built-ins in preloaded module builtin accessible via import
builtin
at loading, modules get an extra attribute named builtins which
refers to either to module builtin or to its dictionary
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 12 / 28
93. Python, the language Modules and Packages
Modules
A typical Python program is made up of several source files
Each source file corresponds to a module that groups variables,
functions, classes, etc. for reuse
A module explicitly establishes its dependencies using the import and
from statements
In some languages global variables provide a hidden mechanism for
coupling between modules
In Python global variables are not global to all modules: they are
attributes of a module object (module.variable)
Extensions, components coded in other languages such as C, C++,
Java, C#, are treated as modules by the python code
In Python everything is defined in a module:
main program or interactive sessions in module main
built-ins in preloaded module builtin accessible via import
builtin
at loading, modules get an extra attribute named builtins which
refers to either to module builtin or to its dictionary
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 12 / 28
94. Python, the language Modules and Packages
Modules
A typical Python program is made up of several source files
Each source file corresponds to a module that groups variables,
functions, classes, etc. for reuse
A module explicitly establishes its dependencies using the import and
from statements
In some languages global variables provide a hidden mechanism for
coupling between modules
In Python global variables are not global to all modules: they are
attributes of a module object (module.variable)
Extensions, components coded in other languages such as C, C++,
Java, C#, are treated as modules by the python code
In Python everything is defined in a module:
main program or interactive sessions in module main
built-ins in preloaded module builtin accessible via import
builtin
at loading, modules get an extra attribute named builtins which
refers to either to module builtin or to its dictionary
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 12 / 28
95. Python, the language Modules and Packages
import modulename
spam.py
#!/usr/bin/env python
# -*- coding: latin-1 -*-
quot;quot;quot;Documentation of the
spam module.quot;quot;quot;
def eggs():
quot;quot;quot;eggs documentationquot;quot;quot;
print quot;eggs !!!quot;
def spam(s):
quot;quot;quot;spam documentationquot;quot;quot;
print quot;spam !!!quot;
if __name__ == quot;__main__quot;:
eggs()
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 13 / 28
96. Python, the language Modules and Packages
import modulename
>>> import spam
spam.py
#!/usr/bin/env python
# -*- coding: latin-1 -*-
quot;quot;quot;Documentation of the
spam module.quot;quot;quot;
def eggs():
quot;quot;quot;eggs documentationquot;quot;quot;
print quot;eggs !!!quot;
def spam(s):
quot;quot;quot;spam documentationquot;quot;quot;
print quot;spam !!!quot;
if __name__ == quot;__main__quot;:
eggs()
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 13 / 28
97. Python, the language Modules and Packages
import modulename
>>> import spam
spam.py >>> spam
#!/usr/bin/env python
# -*- coding: latin-1 -*-
quot;quot;quot;Documentation of the
spam module.quot;quot;quot;
def eggs():
quot;quot;quot;eggs documentationquot;quot;quot;
print quot;eggs !!!quot;
def spam(s):
quot;quot;quot;spam documentationquot;quot;quot;
print quot;spam !!!quot;
if __name__ == quot;__main__quot;:
eggs()
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 13 / 28
98. Python, the language Modules and Packages
import modulename
>>> import spam
spam.py >>> spam
#!/usr/bin/env python <module ’spam’ from ’spam.pyc’>
# -*- coding: latin-1 -*-
quot;quot;quot;Documentation of the
spam module.quot;quot;quot;
def eggs():
quot;quot;quot;eggs documentationquot;quot;quot;
print quot;eggs !!!quot;
def spam(s):
quot;quot;quot;spam documentationquot;quot;quot;
print quot;spam !!!quot;
if __name__ == quot;__main__quot;:
eggs()
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 13 / 28
99. Python, the language Modules and Packages
import modulename
>>> import spam
spam.py >>> spam
#!/usr/bin/env python <module ’spam’ from ’spam.pyc’>
# -*- coding: latin-1 -*- >>> eggs()
quot;quot;quot;Documentation of the
spam module.quot;quot;quot;
def eggs():
quot;quot;quot;eggs documentationquot;quot;quot;
print quot;eggs !!!quot;
def spam(s):
quot;quot;quot;spam documentationquot;quot;quot;
print quot;spam !!!quot;
if __name__ == quot;__main__quot;:
eggs()
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 13 / 28
100. Python, the language Modules and Packages
import modulename
>>> import spam
spam.py >>> spam
#!/usr/bin/env python <module ’spam’ from ’spam.pyc’>
# -*- coding: latin-1 -*- >>> eggs()
quot;quot;quot;Documentation of the Traceback (most recent call last):
spam module.quot;quot;quot; File ’<stdin>’, line 1, in ?
NameError: name ’eggs’ is not defined
def eggs():
quot;quot;quot;eggs documentationquot;quot;quot;
print quot;eggs !!!quot;
def spam(s):
quot;quot;quot;spam documentationquot;quot;quot;
print quot;spam !!!quot;
if __name__ == quot;__main__quot;:
eggs()
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 13 / 28
101. Python, the language Modules and Packages
import modulename
>>> import spam
spam.py >>> spam
#!/usr/bin/env python <module ’spam’ from ’spam.pyc’>
# -*- coding: latin-1 -*- >>> eggs()
quot;quot;quot;Documentation of the Traceback (most recent call last):
spam module.quot;quot;quot; File ’<stdin>’, line 1, in ?
NameError: name ’eggs’ is not defined
def eggs(): >>> spam.eggs()
quot;quot;quot;eggs documentationquot;quot;quot;
print quot;eggs !!!quot;
def spam(s):
quot;quot;quot;spam documentationquot;quot;quot;
print quot;spam !!!quot;
if __name__ == quot;__main__quot;:
eggs()
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 13 / 28
102. Python, the language Modules and Packages
import modulename
>>> import spam
spam.py >>> spam
#!/usr/bin/env python <module ’spam’ from ’spam.pyc’>
# -*- coding: latin-1 -*- >>> eggs()
quot;quot;quot;Documentation of the Traceback (most recent call last):
spam module.quot;quot;quot; File ’<stdin>’, line 1, in ?
NameError: name ’eggs’ is not defined
def eggs(): >>> spam.eggs()
quot;quot;quot;eggs documentationquot;quot;quot; eggs !!!
print quot;eggs !!!quot;
def spam(s):
quot;quot;quot;spam documentationquot;quot;quot;
print quot;spam !!!quot;
if __name__ == quot;__main__quot;:
eggs()
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 13 / 28
103. Python, the language Modules and Packages
import modulename
>>> import spam
spam.py >>> spam
#!/usr/bin/env python <module ’spam’ from ’spam.pyc’>
# -*- coding: latin-1 -*- >>> eggs()
quot;quot;quot;Documentation of the Traceback (most recent call last):
spam module.quot;quot;quot; File ’<stdin>’, line 1, in ?
NameError: name ’eggs’ is not defined
def eggs(): >>> spam.eggs()
quot;quot;quot;eggs documentationquot;quot;quot; eggs !!!
print quot;eggs !!!quot; >>> ham=spam
def spam(s):
quot;quot;quot;spam documentationquot;quot;quot;
print quot;spam !!!quot;
if __name__ == quot;__main__quot;:
eggs()
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 13 / 28
104. Python, the language Modules and Packages
import modulename
>>> import spam
spam.py >>> spam
#!/usr/bin/env python <module ’spam’ from ’spam.pyc’>
# -*- coding: latin-1 -*- >>> eggs()
quot;quot;quot;Documentation of the Traceback (most recent call last):
spam module.quot;quot;quot; File ’<stdin>’, line 1, in ?
NameError: name ’eggs’ is not defined
def eggs(): >>> spam.eggs()
quot;quot;quot;eggs documentationquot;quot;quot; eggs !!!
print quot;eggs !!!quot; >>> ham=spam
>>> ham.spam()
def spam(s):
quot;quot;quot;spam documentationquot;quot;quot;
print quot;spam !!!quot;
if __name__ == quot;__main__quot;:
eggs()
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 13 / 28
105. Python, the language Modules and Packages
import modulename
>>> import spam
spam.py >>> spam
#!/usr/bin/env python <module ’spam’ from ’spam.pyc’>
# -*- coding: latin-1 -*- >>> eggs()
quot;quot;quot;Documentation of the Traceback (most recent call last):
spam module.quot;quot;quot; File ’<stdin>’, line 1, in ?
NameError: name ’eggs’ is not defined
def eggs(): >>> spam.eggs()
quot;quot;quot;eggs documentationquot;quot;quot; eggs !!!
print quot;eggs !!!quot; >>> ham=spam
>>> ham.spam()
def spam(s): spam !!!
quot;quot;quot;spam documentationquot;quot;quot;
print quot;spam !!!quot;
if __name__ == quot;__main__quot;:
eggs()
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 13 / 28
106. Python, the language Modules and Packages
import modulename
>>> import spam
spam.py >>> spam
#!/usr/bin/env python <module ’spam’ from ’spam.pyc’>
# -*- coding: latin-1 -*- >>> eggs()
quot;quot;quot;Documentation of the Traceback (most recent call last):
spam module.quot;quot;quot; File ’<stdin>’, line 1, in ?
NameError: name ’eggs’ is not defined
def eggs(): >>> spam.eggs()
quot;quot;quot;eggs documentationquot;quot;quot; eggs !!!
print quot;eggs !!!quot; >>> ham=spam
>>> ham.spam()
def spam(s): spam !!!
quot;quot;quot;spam documentationquot;quot;quot; >>> dir()
print quot;spam !!!quot;
if __name__ == quot;__main__quot;:
eggs()
J.M.Gimeno (jmgimeno@diei.udl.cat) Python: the Project, ... October 2008 13 / 28