1 / 71

Python Programming Language

Python Programming Language. Python Programming Language. Created in 1991 by Guido Van Rossum. Python Programming Language. General Purpose Language Clean Syntax. Python Programming Language. General Purpose Language Clean Syntax Easy to Learn. Python Programming Language.

Download Presentation

Python Programming Language

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Python Programming Language

  2. Python Programming Language • Created in 1991 by Guido Van Rossum

  3. Python Programming Language • General Purpose Language • Clean Syntax

  4. Python Programming Language • General Purpose Language • Clean Syntax • Easy to Learn

  5. Python Programming Language • General Purpose Language • Clean Syntax • Easy to Learn • Easy to Debug

  6. Python Programming Language • General Purpose Language • Clean Syntax • Easy to Learn • Easy to Debug • “Natural Feeling”

  7. Python Programming Language • General Purpose Language • Interpreted

  8. Python Programming Language • General Purpose Language • Interpreted • No Compilation Phase

  9. Python Programming Language • General Purpose Language • Interpreted • No Compilation Phase • Multiplatform Integration

  10. Python Programming Language • General Purpose Language • Interpreted • No Compilation Phase • Multiplatform Integration • Native Debugger

  11. Python Programming Language • General Purpose Language • Interpreted • Duck Typing

  12. Python Programming Language • General Purpose Language • Interpreted • Duck Typing • Override behaviours by creating methods

  13. Python Programming Language • General Purpose Language • Interpreted • Duck Typing • Override behaviours by creating methods • Implement operations by creating methodst

  14. Python Programming Language • General Purpose Language • Interpreted • Duck Typing • Override behaviours by creating methods • Implement operations by creating methods • All data is an object

  15. Python Programming Language • Objects are Python’s abstraction for data. All data in a Python program is represented by objects or by relations between objects. • Every object has an identity, a type and a value.

  16. Python Programming Language • An object’s identity never changes once it has been created • The ‘is‘ operator compares the identity of two objects • The id() function returns an integer representing its identity

  17. Python Programming Language • An object’s identity never changes once it has been created • The ‘is‘ operator compares the identity of two objects • The id() function returns an integer representing its identity • An object’s type is also unchangeable. • The type() function returns an object’s type (which is an object itself).

  18. Python Programming Language • General Purpose Language • Interpreted • Duck Typing • Strongly Typed

  19. Python Programming Language • A Python programmer can write in any style they like, using design patterns borrowed from: • Imperative • Declarative • Object Oriented • functional programming The author is free let the problem guide the development of the solution.

  20. class Hello(object): def __init__(self, my_string): self.my_string = my_string def __call__(self, render_func): out_str = 'Hello %s' % self.my_string render_func(out_str) def print_string(string_to_print): print(string_to_print) myHelloWorldClass = Hello('world') myHelloWorldClass(print_string) Python Programming Language • print('hello world')

  21. LISP (define (addn n) (lambda (k) (+ n k))) Functional Example • Java: • public class OuterClass { • // Inner class • class AddN { • AddN(int n) { _n = n; } • int add(int v) { return _n + v; } • private int _n; • } • public AddN createAddN(int var) { • return new AddN(var); • } • } Python addn = lambda n: lambda x: x + n Or def addN(n): def add_n(x): return x + n return add_n

  22. The standard Python interpreter (CPython) is written in C89 It is designed with two-way interfacing in mind: Embedding C programs in Python Embedding Python programs in C Modular Design

  23. An Example C Module #include <Python.h> static PyObject * spam_system(PyObject *self, PyObject *args) { const char *command; int sts; if (!PyArg_ParseTuple(args, "s", &command)) return NULL; sts = system(command); return Py_BuildValue("i", sts); } /********************************************************* ** import spam ** ** spam.system( ** ** 'find . -name "*.py" ** ** -exec grep -Hn "Flying Circus" {} \;') ** *********************************************************/ Modular Design

  24. The CPython interpreter can be built on most platforms with a standard C library including glibc and uclibc. Cross Platform Execution

  25. Interpreters such as Jython and IronPython can be used to run a python interpreter on any Java or .NET VM respectively. Cross Platform Execution

  26. Protyping Python Is Good For

  27. Protyping Web Applications/SAS Python Is Good For

  28. Protyping Web Applications/SAS Integration Python Is Good For

  29. Protyping Web Applications/SAS Integration Transport Limited Applications Python Is Good For

  30. Protyping Web Applications/SAS Integration Transport Limited Applications Indeterminate Requirements Python Is Good For

  31. Protyping Web Applications/SAS Integration Transport Limited Applications Indeterminate requirements Short Relevence Lifetime Python Is Good For

  32. Protyping Web Applications/SAS Integration Transport Limited Applications Indeterminate requirements Short Relevence Lifetime Porting Legacy Applications Python Is Good For

  33. Protyping Web Applications/SAS Integration Transport Limited Applications Indeterminate requirements Short Relevence Lifetime Porting Legacy Applications Glue Python Is Good For

  34. Native Cryptography Python is Not Good For

  35. Native Cryptography MILOR Python is Not Good For

  36. Native Cryptography MILOR Highly Parallel Design Python is Not Good For

  37. None __Types__

  38. None NotImplemented __Types__

  39. None NotImplemented Boolean __Types__

  40. None NotImplemented Boolean Int/LongInt __Types__

  41. None NotImplemented Boolean Int/LongInt Float (which is really a double) __Types__

  42. None NotImplemented Boolean Int/LongInt Float (which is really a double) Complex (double +doubleJ) __Types__

  43. None NotImplemented Boolean Int/LongInt Float (which is really a double) Complex (double +doubleJ) Sequences... __Types__

  44. Sequences string unicode bytes tuple list set frozenset __Types__

  45. None NotImplemented Boolean Int/LongInt Float (which is really a double) Complex (double +doubleJ) Sequences... Mapping Types (dict) __Types__

  46. None NotImplemented Boolean Int/LongInt Float (which is really a double) Complex (double +doubleJ) Sequences... Mapping Types (dict) Functions and Methods __Types__

  47. None NotImplemented Boolean Int/LongInt Float (which is really a double) Complex (double +doubleJ) Sequences... Mapping Types (dict) Functions and Methods Generators __Types__

  48. None NotImplemented Boolean Int/LongInt Float (which is really a double) Complex (double +doubleJ) Sequences... Mapping Types (dict) Functions and Methods Generators Modules __Types__

  49. None NotImplemented Boolean Int/LongInt Float (which is really a double) Complex (double +doubleJ) Sequences... Mapping Types (dict) Functions and Methods Generators Modules File/Buffer __Types__

  50. None NotImplemented Boolean Int/LongInt Float (which is really a double) Complex (double +doubleJ) Sequences... Mapping Types (dict) Functions and Methods Generators Modules File/Buffer Type (metaclasses) __Types__

More Related