Python




Session 1: introduction to Python

  José Dapena Paz <jdapena@igalia.com>
Sessions
●   Session 1:
    –   Presentation of language, brief history and practical
        examples of language structu...
First session contents
●   ¿What's Python?
    –   Brief history
    –   Properties
    –   Documentation ¿Where?
●   Intr...
¿What's Python?
●   ¿What's Python?
    –   Brief history
    –   Properties
    –   Documentation ¿Where?
●   Introductio...
¿What's Python?
●   High level language
●   Author: Guido Van Rossum (first release in
    1991)
●   Emphasis on readabili...
History
●   Author: Guido Van Rossum. CWI.
●   Begins Python at the end of 80's. Inspired in
    ABC language.
●   First r...
Cronology
●   1991: 1st release. Classes, inheritance,
    exceptions, modules and basic types list,
    dict y str
●   19...
Python is free software
●   From Python 2.2, Python Foundation Software
    License, GPL-compatible.
●   All code is prope...
Documentation
●   Python is very well documented
    http://docs.python.org
●   Tutorial: http://docs.python.org/tut/
●   ...
First session contents
●   ¿What's Python?
    –   Brief history
    –   Properties
    –   Documentation ¿Where?
●   Intr...
Installation and running


In ubuntu, install Python package:
    $ sudo apt-get install python



Very useful to install ...
Python shell
●   Python is an interpreted language.
●   Modes:
    –   Interactive
    –   File
    –   Command line
    –...
Modo interactivo
Just run Python, and add commands and
 statements in the shell
$ python
Python 2.5.1 (r251:54863, Oct 5 2...
Shell mode help
Whith dir () command we get the methods
 available.
  >>> dir (a) # With instances

  >>> dir (list) # Wit...
Python as a calculator
●   Basic types:
    –   Integers
    –   Floats and complex numbers
    –   Strings
●   Asign
●   ...
Control flow structures
●   While. Indentation in Python
●   If, If-Elif-Else
●   For, range.
●   Break, continue, else, p...
More flow control structures
●   List methods. The list as a queue and as a
    stack.
●   Map, reduce, filter
●   List co...
Modules
●   Modules reference
●   Examples: Files api (File objects), http api
    (urllib2)
Upcoming SlideShare
Loading in...5
×

Introduction to Python

2,955

Published on

Published in: Technology, Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,955
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
180
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Introduction to Python

  1. 1. Python Session 1: introduction to Python José Dapena Paz <jdapena@igalia.com>
  2. 2. Sessions ● Session 1: – Presentation of language, brief history and practical examples of language structures. ● Session 2: – Important projects – Standard libraries – Other modules
  3. 3. First session contents ● ¿What's Python? – Brief history – Properties – Documentation ¿Where? ● Introduction to the language – Installation and usage – Practical examples
  4. 4. ¿What's Python? ● ¿What's Python? – Brief history – Properties – Documentation ¿Where? ● Introduction to the language – Installation and usage – Practical examples
  5. 5. ¿What's Python? ● High level language ● Author: Guido Van Rossum (first release in 1991) ● Emphasis on readability. ● Priority: easy for programmer, then, computer. ● Minimalist language. Wide libraries.
  6. 6. History ● Author: Guido Van Rossum. CWI. ● Begins Python at the end of 80's. Inspired in ABC language. ● First release in 1991. ● Guido Van Rossum: Benevolent Dictator For Life
  7. 7. Cronology ● 1991: 1st release. Classes, inheritance, exceptions, modules and basic types list, dict y str ● 1994: 1.0. Basic functional programming (lambda methods). ● 2001: 1.6.1 y 2.1. GPL compatible license. ● Python 2.2. All types are unified. All are classes. ● Futurr: Python 3000 (3.0) in 2008.
  8. 8. Python is free software ● From Python 2.2, Python Foundation Software License, GPL-compatible. ● All code is property of Python Foundation. ● Python community show a very high activity: – Hundreds of modules/extensions available. – Lots of software available implemented in Python. – Python is the language of 2007 (language TIOBE, Python had biggest increase of usage).
  9. 9. Documentation ● Python is very well documented http://docs.python.org ● Tutorial: http://docs.python.org/tut/ ● Language reference: (for language lawyers): http://docs.python.org/ref/ ● Library reference: http://docs.python.org/lib/
  10. 10. First session contents ● ¿What's Python? – Brief history – Properties – Documentation ¿Where? ● Introduction to the language – Installation and usage – Practical examples
  11. 11. Installation and running In ubuntu, install Python package: $ sudo apt-get install python Very useful to install online documentation: $ sudo apt-get install python-doc
  12. 12. Python shell ● Python is an interpreted language. ● Modes: – Interactive – File – Command line – Executable
  13. 13. Modo interactivo Just run Python, and add commands and statements in the shell $ python Python 2.5.1 (r251:54863, Oct 5 2007, 13:36:32) [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2 Type quot;helpquot;, quot;copyrightquot;, quot;creditsquot; or quot;licensequot; for more information. >>> 1+1 2 >>> a = ”hola” >>> a 'hola' >>> print a hola
  14. 14. Shell mode help Whith dir () command we get the methods available. >>> dir (a) # With instances >>> dir (list) # With classes With help () command we get the help of a class or instance. >>> help (a) # With instances (no strings) >>> help (list) # With classes
  15. 15. Python as a calculator ● Basic types: – Integers – Floats and complex numbers – Strings ● Asign ● _ variable ● Lists. Ranges, asigns by range, operators.
  16. 16. Control flow structures ● While. Indentation in Python ● If, If-Elif-Else ● For, range. ● Break, continue, else, pass ● Functions. Definition. ● Classes
  17. 17. More flow control structures ● List methods. The list as a queue and as a stack. ● Map, reduce, filter ● List comprehensions ● Del ● Other sequences: tuples. Dictionaries ● Looping ● Conditions, conditions in sequences.
  18. 18. Modules ● Modules reference ● Examples: Files api (File objects), http api (urllib2)
  1. Gostou de algum slide específico?

    Recortar slides é uma maneira fácil de colecionar informações para acessar mais tarde.

×