SlideShare una empresa de Scribd logo
1 de 13
24/03/2014 Kevin Van Wilder - Django & Python 1
Python
24-03-2014
Kevin Van Wilder
24/03/2014 Kevin Van Wilder - Django & Python 2
Archeological finds
suggest...
● 1991 Python 1.0
– Guido van Rossum
● 2000 Python 2.0
– Scripting in Operating Systems
– Recent years: Endorsed by Google
● 2005 Django
● 2008 Python 3.0
– Backwards Incompatible
● 2009 MIT switches to Python to teach Computer Science to
students (6.001)
24/03/2014 Kevin Van Wilder - Django & Python 3
Python is used for...
● Rapid Prototyping
● Web application development
● Scientific calculations
● XML Processing
● Database applications
● GUI applications
● Glue language for different systems
24/03/2014 Kevin Van Wilder - Django & Python 4
What is Python?
● Easy to learn and master
– Clean and clear syntax
– Very few keywords
– High Level data types
– Compact
● Highly portable
– Runs everywhere
● Highly extensible
– Libraries may be written in python or C/C++
24/03/2014 Kevin Van Wilder - Django & Python 5
What is Python?
● High Level Programming Language
● Interpreted Language
– Works “similar to Java” behind the scenes
● Source compiles to Bytecode (.pyc files)
● Bytecode is translated on a “virtual machine” as machine code.
– Different implementations of the interpreter:
● CPython (reference implementation)
● Jython (Java-based implementation)
● PyPy (JIT implementation)
● Read-Eval-Print Loop (REPL)
24/03/2014 Kevin Van Wilder - Django & Python 6
Variables & Types
● No declaration
● Everything has an object type
● Integer division like in C
● High level data types
– Collections, Lists vs Tuples, Dicts
– Auto unpacking
>>> a = 1
>>> a
1
>>> type(a)
<type 'int'>
>>> a = “Hello”
>>> type(a)
<type 'string'>
>>> 5/2
2
>>> 5.0/2
2.5
>>> x, y = 2, 3
>>> x
2
>>> y
3
24/03/2014 Kevin Van Wilder - Django & Python 7
Logic Flow
● For, while loops
● Generators
● Exception Handling
>>> for ch in “Hello”:
… print ch
…
H
e
l
l
o
>>> for i in range(3):
… print i
…
0
1
2
>>>
>>> try:
… connect_to_a_broken_server()
… except ConnectionError as e:
… print “Stuff is broken!”
… finally:
… print “End of the line”
Stuff is broken!
End of the line
>>>
24/03/2014 Kevin Van Wilder - Django & Python 8
Classes
● Class statement
● First class citizen
use as:
– Parameter
– Return value
– Variable assignment
>>> class Foo(object):
…. def __init__(self):
…. self.member = 1
…. def get_member(self):
…. return self.member
….
>>> Foo
<class __main__.Foo at 1000960>
>>> f = Foo()
>>> f
<type 'Foo'>
>>> f.get_member()
1
>>>
24/03/2014 Kevin Van Wilder - Django & Python 9
The Language
● Object-Oriented
– Everything is internally an object, even integers and strings
– Supports imperative, functional and procedural development
● Minimalistic
– Indentation defines scoping
– No line delimiters
● Dynamically and Strongly Typed
● Packages, Modules
24/03/2014 Kevin Van Wilder - Django & Python 10
Standard Library
● Very large set of modules with diverse
functionality:
– All internet protocols, sockets, cgi, os services
– GUI, database, calendar, file operations
– Debugging, profiling
– Threading, synchronization
● http://docs.python.org/2/library/
24/03/2014 Kevin Van Wilder - Django & Python 11
Third party libraries
● Awesome python libraries
– Requests
http://docs.python-requests.org
– Pillow
http://pillow.readthedocs.org
– Dateutil
https://pypi.python.org/pypi/python-dateutil
– DocOpt
https://pypi.python.org/pypi/docopt
● But also:
– And about 40.000+ more!
– Numerical analysis, sql databases, fortran, xml, win32, serial connections, qt,
tkinter, etc etc etc etc etc
24/03/2014 Kevin Van Wilder - Django & Python 12
Python is...
● The syntax
● The standard library
● The external library
● The community
24/03/2014 Kevin Van Wilder - Django & Python 13
Learning Resources
● “Learn Python The Hard Way” (not really) -
http://learnpythonthehardway.org/
● “Crash Into Python” -
http://www.learnpython.org/
● Read The Fine Manual
http://docs.python.org/

Más contenido relacionado

Similar a Django and Python Introduction @ UGent

Python bootcamp - C4Dlab, University of Nairobi
Python bootcamp - C4Dlab, University of NairobiPython bootcamp - C4Dlab, University of Nairobi
Python bootcamp - C4Dlab, University of Nairobi
krmboya
 

Similar a Django and Python Introduction @ UGent (20)

C Sharp Crash Course
C Sharp Crash CourseC Sharp Crash Course
C Sharp Crash Course
 
Interop 2015: Hardly Enough Theory, Barley Enough Code
Interop 2015: Hardly Enough Theory, Barley Enough CodeInterop 2015: Hardly Enough Theory, Barley Enough Code
Interop 2015: Hardly Enough Theory, Barley Enough Code
 
Python bootcamp - C4Dlab, University of Nairobi
Python bootcamp - C4Dlab, University of NairobiPython bootcamp - C4Dlab, University of Nairobi
Python bootcamp - C4Dlab, University of Nairobi
 
What Your Tech Lead Thinks You Know (But Didn't Teach You)
What Your Tech Lead Thinks You Know (But Didn't Teach You)What Your Tech Lead Thinks You Know (But Didn't Teach You)
What Your Tech Lead Thinks You Know (But Didn't Teach You)
 
Programming with Python - Basic
Programming with Python - BasicProgramming with Python - Basic
Programming with Python - Basic
 
Doctrine Project
Doctrine ProjectDoctrine Project
Doctrine Project
 
SouthEast LinuxFest 2015 - Managing linux in a engineering college
SouthEast LinuxFest 2015 -  Managing linux in a engineering collegeSouthEast LinuxFest 2015 -  Managing linux in a engineering college
SouthEast LinuxFest 2015 - Managing linux in a engineering college
 
Pentester++
Pentester++Pentester++
Pentester++
 
Python lecture 01
Python lecture 01Python lecture 01
Python lecture 01
 
A Python Tutorial
A Python TutorialA Python Tutorial
A Python Tutorial
 
Go Is Your Next Language — Sergii Shapoval
Go Is Your Next Language — Sergii ShapovalGo Is Your Next Language — Sergii Shapoval
Go Is Your Next Language — Sergii Shapoval
 
Tracing MariaDB server with bpftrace - MariaDB Server Fest 2021
Tracing MariaDB server with bpftrace - MariaDB Server Fest 2021Tracing MariaDB server with bpftrace - MariaDB Server Fest 2021
Tracing MariaDB server with bpftrace - MariaDB Server Fest 2021
 
The New York Times: Sustainable Systems, Powered by Python
The New York Times: Sustainable Systems, Powered by PythonThe New York Times: Sustainable Systems, Powered by Python
The New York Times: Sustainable Systems, Powered by Python
 
Python_intro.ppt
Python_intro.pptPython_intro.ppt
Python_intro.ppt
 
Python in programming competitions
Python in programming competitionsPython in programming competitions
Python in programming competitions
 
PhpStorm: Symfony2 Plugin
PhpStorm: Symfony2 PluginPhpStorm: Symfony2 Plugin
PhpStorm: Symfony2 Plugin
 
IT talk "Python language evolution"
IT talk "Python language evolution"IT talk "Python language evolution"
IT talk "Python language evolution"
 
PyCon Taiwan 2013 Tutorial
PyCon Taiwan 2013 TutorialPyCon Taiwan 2013 Tutorial
PyCon Taiwan 2013 Tutorial
 
Python for PHP developers
Python for PHP developersPython for PHP developers
Python for PHP developers
 
Symfony2 - A Short Introduction
Symfony2 - A Short IntroductionSymfony2 - A Short Introduction
Symfony2 - A Short Introduction
 

Último

Último (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 

Django and Python Introduction @ UGent

  • 1. 24/03/2014 Kevin Van Wilder - Django & Python 1 Python 24-03-2014 Kevin Van Wilder
  • 2. 24/03/2014 Kevin Van Wilder - Django & Python 2 Archeological finds suggest... ● 1991 Python 1.0 – Guido van Rossum ● 2000 Python 2.0 – Scripting in Operating Systems – Recent years: Endorsed by Google ● 2005 Django ● 2008 Python 3.0 – Backwards Incompatible ● 2009 MIT switches to Python to teach Computer Science to students (6.001)
  • 3. 24/03/2014 Kevin Van Wilder - Django & Python 3 Python is used for... ● Rapid Prototyping ● Web application development ● Scientific calculations ● XML Processing ● Database applications ● GUI applications ● Glue language for different systems
  • 4. 24/03/2014 Kevin Van Wilder - Django & Python 4 What is Python? ● Easy to learn and master – Clean and clear syntax – Very few keywords – High Level data types – Compact ● Highly portable – Runs everywhere ● Highly extensible – Libraries may be written in python or C/C++
  • 5. 24/03/2014 Kevin Van Wilder - Django & Python 5 What is Python? ● High Level Programming Language ● Interpreted Language – Works “similar to Java” behind the scenes ● Source compiles to Bytecode (.pyc files) ● Bytecode is translated on a “virtual machine” as machine code. – Different implementations of the interpreter: ● CPython (reference implementation) ● Jython (Java-based implementation) ● PyPy (JIT implementation) ● Read-Eval-Print Loop (REPL)
  • 6. 24/03/2014 Kevin Van Wilder - Django & Python 6 Variables & Types ● No declaration ● Everything has an object type ● Integer division like in C ● High level data types – Collections, Lists vs Tuples, Dicts – Auto unpacking >>> a = 1 >>> a 1 >>> type(a) <type 'int'> >>> a = “Hello” >>> type(a) <type 'string'> >>> 5/2 2 >>> 5.0/2 2.5 >>> x, y = 2, 3 >>> x 2 >>> y 3
  • 7. 24/03/2014 Kevin Van Wilder - Django & Python 7 Logic Flow ● For, while loops ● Generators ● Exception Handling >>> for ch in “Hello”: … print ch … H e l l o >>> for i in range(3): … print i … 0 1 2 >>> >>> try: … connect_to_a_broken_server() … except ConnectionError as e: … print “Stuff is broken!” … finally: … print “End of the line” Stuff is broken! End of the line >>>
  • 8. 24/03/2014 Kevin Van Wilder - Django & Python 8 Classes ● Class statement ● First class citizen use as: – Parameter – Return value – Variable assignment >>> class Foo(object): …. def __init__(self): …. self.member = 1 …. def get_member(self): …. return self.member …. >>> Foo <class __main__.Foo at 1000960> >>> f = Foo() >>> f <type 'Foo'> >>> f.get_member() 1 >>>
  • 9. 24/03/2014 Kevin Van Wilder - Django & Python 9 The Language ● Object-Oriented – Everything is internally an object, even integers and strings – Supports imperative, functional and procedural development ● Minimalistic – Indentation defines scoping – No line delimiters ● Dynamically and Strongly Typed ● Packages, Modules
  • 10. 24/03/2014 Kevin Van Wilder - Django & Python 10 Standard Library ● Very large set of modules with diverse functionality: – All internet protocols, sockets, cgi, os services – GUI, database, calendar, file operations – Debugging, profiling – Threading, synchronization ● http://docs.python.org/2/library/
  • 11. 24/03/2014 Kevin Van Wilder - Django & Python 11 Third party libraries ● Awesome python libraries – Requests http://docs.python-requests.org – Pillow http://pillow.readthedocs.org – Dateutil https://pypi.python.org/pypi/python-dateutil – DocOpt https://pypi.python.org/pypi/docopt ● But also: – And about 40.000+ more! – Numerical analysis, sql databases, fortran, xml, win32, serial connections, qt, tkinter, etc etc etc etc etc
  • 12. 24/03/2014 Kevin Van Wilder - Django & Python 12 Python is... ● The syntax ● The standard library ● The external library ● The community
  • 13. 24/03/2014 Kevin Van Wilder - Django & Python 13 Learning Resources ● “Learn Python The Hard Way” (not really) - http://learnpythonthehardway.org/ ● “Crash Into Python” - http://www.learnpython.org/ ● Read The Fine Manual http://docs.python.org/