SlideShare a Scribd company logo
1 of 44
Download to read offline
csccit2011	
University of Tabriz	
by Omid Mogharian
omid.mogharian@gmail.com
outline	
• 
• 
• 
• 
• 
• 

What is python?	
Why python?	
Introduction to python	
Python programming: Tips & Tricks	
More on python	
Scienti"c module
What is python?	
•  Python is a Interpreted, Interactive, Portable,
Functional / Object-Oriented programing
language.	
•  Invented by “Guido Van Rossum” in 1991. 	
•  free and open source develop by “python
software foundation”, available at
www.python.org	
•  "nal release: Python 2.7.2 , python 3.2.2
Why python?	
• 
• 
• 
• 
• 
• 

Multi purpose design (web, os. application ,scienti"c, …)	
Cross platform (wide portability)	
Both Functional & O.O programming	
Rapid in Prototyping, strong in enterprise system	
Integrate with other languages (c/c++, java, fortran, …)	
Dynamic, Extensible, readable.
Why python?	
• 
• 
• 
• 
• 
• 

Many library and module 	
Easy to use (simple & familiar syntax ,few restrictions & rules)	
Automatic memory management (Garbage Collector)	
Good element (Dictionary, List, … ) 	
Good built-in algorithms (hashing , sorting , …)	
Many companies & institutions around the world
use python (Google, Yahoo, NASA, YouTube, FriendFeed , …)
Introduction to python	
•  Start with python	

–  Set up	
•  Linux , mac os X. and most operating systems have Python 	
•  For windows, download python installer and run it.	
–  Run 	
•  Use interactive mode by type “python” in Terminal	
•  “python ["lename].py” run python code "les	
–  lDE	
•  Every text editor with a little understanding of code : 	
notepad++,Gedit, jedit, …	
•  IDLE python editor releasing by “python.org”	
•  KOMODO is a good one!
Introduction to python	
•  Strings 	

–  Concatenation “Hello” + “World” -> “HelloWorld”	
–  Repetition “Tabrizu” * 3 -> “TabrizuTabrizuTabrizu” 	
–  Indexing “Tabrizu”[2] ->“b” , “Tabrizu”[-2] -> “z” 	
–  Slicing “Tabrizu”[1:4] -> “abri”	
–  Size len(“Tabrizu”)-> 7	
–  Comparison “Tabrizu” > “tabrizu” -> fasle	
–  Search “u” in “Tabrizu” -> true
Introduction to python	
•  Lists	

–  e.g. aList = [631, “python”, [331, “tb”]]	

–  Like indexable arrays, not like linked list	
–  Same operators as for strings 	
–  More operations append(), insert(), pop(), reverse() and
sort()	

•  Sets	
–  e.g. aSet=set([‘tabrizu’,’ploytechnic’,’tehran’])	
–  add(x), remove(x), discard(x), pop(), clear(), issubset(),
issuperset(), …	
–  Union ‘|’, intersection ‘&’, di#erence ‘#’
Introduction to python	
•  Tuples	
  	

–  e.g. aTuple = (631, “python”, (611, “SA”))	
–  Unlike	
  lists	
  and	
  like	
  strings	
  &	
  set	
  tuples	
  are	
  immutable	
  	

•  Dic6onaries	
  	
  

–  e.g. adict= {“tabriz”:”python”,”tehran”:”Java”}	
–  Lookup	
  	
  adict[“tabriz”] -> ”python”	
  
–  Insert	
  	
  adict[“value”] = 100	
  
–  Delete	
  	
  del adict[“value”]	
–  Presencie	
  	
  adict.has_key(“tehran”) -> True	
–  Itera6ons	
  	
  keys(), values(), items()
Introduction to python	
•  Variables 	
–  No need to declare, Not typed but need to initialize 	
–  Almost everything can be assigned to a variable (functions,
modules, classes) 	
–  All variable are reference (a=b means a & b refer to same object)	
•  Flow of Control	
–  if condition : statements (elif condition : statements)
[else : statements] 	
–  while condition : statements [else : statements] 	
–  for var in sequence : statements [else : statements] 	
–  Break & Continue
Introduction to python	
•  Functions 	
–  def FunctionName(arg1, arg2, ...):	
Statements	
	return (expression)	

	
•  Classes	
–  class ClassName(BaseClass1, BaseClass2...) : 	
	Statements	
–  x = ClassName() creates a new instance
Introduction to python	
•  A simple example
Introduction to python
Introduction to python	
> this is a static function!
Introduction to python	

> yes!
Introduction to python	

> omid!
Introduction to python	

>

AttributeError: cls instance has no attribute 'name’!
Introduction to python	
>

len of prob is 1

and this is a external function!
Introduction to python	
> this is overwrite function!
Introduction to python	
> <__main__.cls instance at 0x10aeac440>!
Introduction to python	
•  Modules	
–  Usage:	
  e.g.	
  	
  import	
  datetime	
	 		
–  Partial usage: e.g. from datetime import time	
		
–  bult-in , installed and beside of code .py "les modules	

		
• 	 example	
		
> Python test.py jim!
> Hello jim!
Tips & Tricks	
None and empty cheaking	
  
my_object = 'Test' # True example!
# my_object = '' or my_object = None # False example!
if len(my_object) > 0:!
!print 'my_object is not empty'!
!
if len(my_object): # 0 will evaluate to False!
print 'my_object is not empty’!
if my_object != '':!
print 'my_object is not empty’!
!
if my_object: # an empty string will evaluate to False!
print 'my_object is not empty'
Tips & Tricks	
Divition and $oat numbers	
  

5/2
5.0/2
float(5)/2
5//2
!
	

#
#
#
#

Returns
Returns
Returns
Returns

2!
2.5!
2.5!
2!

from __future__ import division!
5/2
# Returns 2.5!
5.0/2
# Returns 2.5!
float(5)/2 # Returns 2.5!
5//2
# Returns 2
Tips & Tricks	
In one line!	
  
list= [’tabriz', ’tehran', ’shiraz']!
print 'The three are: %s.' % ', '.join(list)!
# print the tree are tabriz, tehran, shiraz!
!
validation= True if list else 'Test is False'!
# validation is True!
!
!
!
!
!
Tips & Tricks	
lambda	
  
def add(a,b): return a+b!
add2 = lambda a,b: a+b	
squares = map(lambda a: a*a, [1,2,3,4])!
Squares = a*a for a in [1,2,3,4]!
squares is now [1,4,9,16]
Tips & Tricks	
Lambda & one line for 	
  
numbers = [1,2,3,4,5]!
numbers_under_4 = filter(lambda x: x < 4, numbers)!
numbers_under_4 = [number for number in numbers if number < 4]!
# numbers_under_4 = [1,2,3]!
!
squares = map(lambda x: x*x, filter(lambda x: x < 4, numbers))!
squares = [number*number for number in numbers if number < 4]!
# square is now [1,4,9]
Tips & Tricks	
one line for Vs nested for 	
  
print [(x, y, x * y) for x in (0,1,2,3) for y in (0,1,2,3) if x < y]!
# prints [(0, 1, 0), (0, 2, 0), (0, 3, 0), (1, 2, 2), (1, 3, 3), (2, 3, 6)]!

!
for x in (0,1,2,3):!
for y in (0,1,2,3):!
if x < y:!
print (x, y, x*y),!
# prints (0, 1, 0) (0, 2, 0) (0, 3, 0) (1, 2, 2) (1, 3, 3) (2, 3, 6)!
!
Tips & Tricks	
Lambda …	
  
numbers = [1,2,3,4,5]!
!
result = reduce(lambda a,b: a*b, numbers)!
!
result = 1!
for number in numbers:!
!result *= number!
!
# result is now 120
Tips & Tricks	
….	
  

!
!
strings = ['a', 'b', 'c', 'd', 'e’]!
for index, string in enumerate(strings):!
print index, string,!
# prints '0 a 1 b 2 c 3 d 4 e’!
!
numbers = [1,10,100,1000,10000]!
if any(number < 10 for number in numbers):!
print 'Success’!
# Output: 'Success!'
Tips & Tricks	
….	
  
!

!
if all(number < 10 for number in numbers):!
print 'Success!’!
# Output: (nothing)!
!
!
test = True!
result = ['Test is False','Test is True'][test]!
# result is now 'Test is True’!
Tips & Tricks	
Default value	
  
!
def function(item, stuff = []):!
stuff.append(item)!
print stuff!
!
function(1)!
# prints '[1]’!
function(2)!
# prints '[1,2]' !!!!
!
!
!
Tips & Tricks	
Arbitrary	
  Numbers	
  of	
  Arguments	
  
!
!
!
def do_something_else(a, b, c, *args, **kwargs):!
print a, b, c, args, kwargs!
!
!
do_something_else(1,2,3,4,5,6,7,8,9, timeout=1.5)!
# prints '1, 2, 3, (4, 5, 6, 7, 8, 9), {"timeout":
1.5}'!
Tips & Tricks	
Decorator	
  
def decorator1(func):!
return lambda: func() + 1!
def decorator2(func):!
def print_func():!
print func()!
return print_func!
!

@decorator2!
@decorator1!
def function():!
return 41!
function()!
!
function =
decorator2(decorator1(function))!
# prints '42'
Tips & Tricks	
!
Dict	
  /	
  Object	
  

!
class mydict(dict):!
def __getattr__(self, attr):!
if super(mydict,self).has_key(attr):!
return super(mydict,self).__getitem__(attr)!
!
def __setattr__(self,attr,value):!
super(mydict,self).__setattr__(attr,value)!
!
adict= {‘apple’:1 ,’banana’:2 , ‘peach’:3}!
mdict=mydict(adict)!
mdict.orange=10!
print mdict.apple, mdict.orange , mdict[‘banana’] , mdict!
# prints '1

!

10

2 {‘apple’:1 ,’banana’:2 , ‘peach’:3 , ‘orange’:10}’!
More on python	
•  Commercial Usage	
– 
– 
– 
– 

MVC Web programming via web server modules: Tornado, cherrypy ,… 	
Mobile programming :PyObjC, ASE , …	
Easily connect to famous DB: MSSQL, Mysql , Oracle,…	
designed for non-relational DB linke Cassandra, MongoDB, CouchDB.	

What is Non-relational DB!?	
•  No relation between data, Provide list, vector, nested data "elds	
•  No force schema & type	
•  Java script base syntax instead of SQL	
•  Document-oriented , Key-Value and Object-oriented database
More on python	
•  Integrating Python With Other Languages	
–  SWIG - generate extension module from your .h "les	

–  F2PY - Fortran to Python Interface Generator	
–  Lython (archived page) - Lisp front-end for Python 	
–  JPype Java for CPython 	

•  Python interpreters	
–  Cpython a bytecode interpreter (Orginal)	

– 
– 
– 
– 

PyPy	
  a	
  JIT	
  Compiler,	
  more Speed	
  &	
  efficiency	
  
ShedSkin	
  a	
  Python	
  to	
  C++	
  programming	
  language	
  compiler	
  
Jython a Java implemented of Python	
  	
ironpython a .net implemented of python
Scienti"c module	
•  Numeric	
  Module	
  	
–  NumPy	
  	
  	
  Numerical	
  Python	
  adds	
  a	
  fast,	
  compact,	
  mul6dimensional	
  array	
  
facility	
  to	
  Python	
  
–  SciPy	
  	
  Includes	
  modules	
  for	
  linear	
  algebra,	
  op6miza6on,	
  integra6on,	
  
special	
  func6ons,	
  sta6s6cs,	
  and	
  others.	
  	
  
–  OpenOpt	
  a	
  framework	
  for	
  numerical	
  op6miza6on	
  and	
  systems	
  of	
  linear/
non-­‐linear	
  equa6ons.	
  	
  
–  ALGLIB	
  	
  numerical	
  analysis	
  library	
  in	
  C++	
  and	
  C#,	
  with	
  Python	
  interfaces.	
  	
  
–  SpaceFuncs	
  -­‐	
  a	
  tool	
  for	
  2D,	
  3D,	
  N-­‐dimensional	
  geometric	
  modeling	
  with	
  
possibili6es	
  of	
  parametrized	
  calcula6ons,	
  numerical	
  op6miza6on	
  and	
  
solving	
  systems	
  of	
  geometrical	
  equa6ons	
  with	
  automa6c	
  differen6a6on.	
  	
  
Scienti"c module	
•  Algorithm	
  Module	
  	
  
–  Mlpy	
  	
  Machine	
  Learning	
  Python	
  and	
  high-­‐performance	
  Python	
  
module	
  for	
  Predic6ve	
  Modeling	
  
–  SciPy	
  for	
  signal	
  and	
  image	
  processing,	
  gene6c	
  algorithms	
  
–  graph-­‐tool	
  	
  A	
  python	
  module	
  for	
  efficient	
  analysis	
  of	
  graphs	
  (aka.	
  
Networks)	
  
–  Pyevolve is evolutionary algoritm. Machin learning.
Scienti"c module	
•  Grid	
  CompuAng	
  Module	
  
–  PyGlobus	
  Globus	
  toolkit	
  bindings	
  for	
  python	
  	
  
–  PEG	
  	
  Python	
  Extensions	
  for	
  the	
  Grid	
  	
  
–  Ganga	
  	
  Grid	
  job	
  management	
  interface.	
  	
  
–  DIANE	
  Python	
  user-­‐level	
  middleware	
  layer	
  for	
  Grids.	
  	
  
	
  	
  
Scienti"c module	
•  Other	
  ScienAfic	
  Module	
  	
  
–  ScienAficPython	
  is	
  a	
  collec6on	
  of	
  Python	
  scien6fic	
  modules	
  
–  Thuban	
  is	
  a	
  Python	
  Interac6ve	
  Geographic	
  Data	
  Viewer	
  	
  
–  Matplotlib	
  	
  hp://matplotlib.sourceforge.net/	
  -­‐	
  matplotlib	
  is	
  a	
  
python	
  2D	
  plo]ng	
  library	
  	
  
–  Biopython	
  -­‐	
  a	
  set	
  of	
  freely	
  available	
  tools	
  for	
  biological	
  
computa6on	
  and	
  bioinforma6cs.	
  

–  PyMol	
  	
  3D	
  molecular	
  viewer	
  
Scienti"c module	
•  Exmaple	
  Usige	
  Pyevolve 	
–  Installing pakages 	
> apt-­‐get	
  install	
  python-­‐setuptools!
> easy_install	
  pyevolve!
Or instal .egg pakage	
> easy_install	
  /downloads/downloaded_package.egg	
  !
Scienti"c module	
•  Exmaple	
  Usige	
  Pyevolve
Refrences	
•  Python	
  Homepage	
  	
  
	
  hJp://www.python.org/	
  
•  Python	
  wiki	
  	
  
	
  hJp://wiki.python.org/	
  
•  Google	
  Code	
  University	
  	
  
	
  hJp://code.google.com/edu/	
  
•  Python	
  	
  documentaAon	
  	
  
hJp://docs.python.org/
Thanks	
  for	
  your	
  aJenAon

More Related Content

What's hot

Advanced geoprocessing with Python
Advanced geoprocessing with PythonAdvanced geoprocessing with Python
Advanced geoprocessing with PythonChad Cooper
 
TensorFlow 深度學習快速上手班--自然語言處理應用
TensorFlow 深度學習快速上手班--自然語言處理應用TensorFlow 深度學習快速上手班--自然語言處理應用
TensorFlow 深度學習快速上手班--自然語言處理應用Mark Chang
 
Analysis of Fatal Utah Avalanches with Python. From Scraping, Analysis, to In...
Analysis of Fatal Utah Avalanches with Python. From Scraping, Analysis, to In...Analysis of Fatal Utah Avalanches with Python. From Scraping, Analysis, to In...
Analysis of Fatal Utah Avalanches with Python. From Scraping, Analysis, to In...Matt Harrison
 
Programming Lisp Clojure - 2장 : 클로저 둘러보기
Programming Lisp Clojure - 2장 : 클로저 둘러보기Programming Lisp Clojure - 2장 : 클로저 둘러보기
Programming Lisp Clojure - 2장 : 클로저 둘러보기JangHyuk You
 
How to Become a Tree Hugger: Random Forests and Predictive Modeling for Devel...
How to Become a Tree Hugger: Random Forests and Predictive Modeling for Devel...How to Become a Tree Hugger: Random Forests and Predictive Modeling for Devel...
How to Become a Tree Hugger: Random Forests and Predictive Modeling for Devel...Matt Harrison
 
Begin with Machine Learning
Begin with Machine LearningBegin with Machine Learning
Begin with Machine LearningNarong Intiruk
 
Mapping the world with DataMapper
Mapping the world with DataMapperMapping the world with DataMapper
Mapping the world with DataMapperTed Han
 
Beginners python cheat sheet - Basic knowledge
Beginners python cheat sheet - Basic knowledge Beginners python cheat sheet - Basic knowledge
Beginners python cheat sheet - Basic knowledge O T
 
Modern Application Foundations: Underscore and Twitter Bootstrap
Modern Application Foundations: Underscore and Twitter BootstrapModern Application Foundations: Underscore and Twitter Bootstrap
Modern Application Foundations: Underscore and Twitter BootstrapHoward Lewis Ship
 
Active Support Core Extensions (1)
Active Support Core Extensions (1)Active Support Core Extensions (1)
Active Support Core Extensions (1)RORLAB
 
From Zero to Iterators: Building and Extending the Iterator Hierarchy in a Mo...
From Zero to Iterators: Building and Extending the Iterator Hierarchy in a Mo...From Zero to Iterators: Building and Extending the Iterator Hierarchy in a Mo...
From Zero to Iterators: Building and Extending the Iterator Hierarchy in a Mo...Patrick Niedzielski
 
Down the rabbit hole, profiling in Django
Down the rabbit hole, profiling in DjangoDown the rabbit hole, profiling in Django
Down the rabbit hole, profiling in DjangoRemco Wendt
 
Python tutorial
Python tutorialPython tutorial
Python tutorialnazzf
 
Python's magic methods
Python's magic methodsPython's magic methods
Python's magic methodsReuven Lerner
 
あたかも自然言語を書くようにコーディングしてみる
あたかも自然言語を書くようにコーディングしてみるあたかも自然言語を書くようにコーディングしてみる
あたかも自然言語を書くようにコーディングしてみるKazuya Numata
 
Observational Science With Python and a Webcam
Observational Science With Python and a WebcamObservational Science With Python and a Webcam
Observational Science With Python and a WebcamIntellovations, LLC
 

What's hot (20)

Advanced geoprocessing with Python
Advanced geoprocessing with PythonAdvanced geoprocessing with Python
Advanced geoprocessing with Python
 
TensorFlow 深度學習快速上手班--自然語言處理應用
TensorFlow 深度學習快速上手班--自然語言處理應用TensorFlow 深度學習快速上手班--自然語言處理應用
TensorFlow 深度學習快速上手班--自然語言處理應用
 
Analysis of Fatal Utah Avalanches with Python. From Scraping, Analysis, to In...
Analysis of Fatal Utah Avalanches with Python. From Scraping, Analysis, to In...Analysis of Fatal Utah Avalanches with Python. From Scraping, Analysis, to In...
Analysis of Fatal Utah Avalanches with Python. From Scraping, Analysis, to In...
 
Programming Lisp Clojure - 2장 : 클로저 둘러보기
Programming Lisp Clojure - 2장 : 클로저 둘러보기Programming Lisp Clojure - 2장 : 클로저 둘러보기
Programming Lisp Clojure - 2장 : 클로저 둘러보기
 
How to Become a Tree Hugger: Random Forests and Predictive Modeling for Devel...
How to Become a Tree Hugger: Random Forests and Predictive Modeling for Devel...How to Become a Tree Hugger: Random Forests and Predictive Modeling for Devel...
How to Become a Tree Hugger: Random Forests and Predictive Modeling for Devel...
 
Begin with Machine Learning
Begin with Machine LearningBegin with Machine Learning
Begin with Machine Learning
 
Mapping the world with DataMapper
Mapping the world with DataMapperMapping the world with DataMapper
Mapping the world with DataMapper
 
Beginners python cheat sheet - Basic knowledge
Beginners python cheat sheet - Basic knowledge Beginners python cheat sheet - Basic knowledge
Beginners python cheat sheet - Basic knowledge
 
Modern Application Foundations: Underscore and Twitter Bootstrap
Modern Application Foundations: Underscore and Twitter BootstrapModern Application Foundations: Underscore and Twitter Bootstrap
Modern Application Foundations: Underscore and Twitter Bootstrap
 
Active Support Core Extensions (1)
Active Support Core Extensions (1)Active Support Core Extensions (1)
Active Support Core Extensions (1)
 
From Zero to Iterators: Building and Extending the Iterator Hierarchy in a Mo...
From Zero to Iterators: Building and Extending the Iterator Hierarchy in a Mo...From Zero to Iterators: Building and Extending the Iterator Hierarchy in a Mo...
From Zero to Iterators: Building and Extending the Iterator Hierarchy in a Mo...
 
1. python
1. python1. python
1. python
 
Python Part 1
Python Part 1Python Part 1
Python Part 1
 
ES6 and BEYOND
ES6 and BEYONDES6 and BEYOND
ES6 and BEYOND
 
Python Part 2
Python Part 2Python Part 2
Python Part 2
 
Down the rabbit hole, profiling in Django
Down the rabbit hole, profiling in DjangoDown the rabbit hole, profiling in Django
Down the rabbit hole, profiling in Django
 
Python tutorial
Python tutorialPython tutorial
Python tutorial
 
Python's magic methods
Python's magic methodsPython's magic methods
Python's magic methods
 
あたかも自然言語を書くようにコーディングしてみる
あたかも自然言語を書くようにコーディングしてみるあたかも自然言語を書くようにコーディングしてみる
あたかも自然言語を書くようにコーディングしてみる
 
Observational Science With Python and a Webcam
Observational Science With Python and a WebcamObservational Science With Python and a Webcam
Observational Science With Python and a Webcam
 

Similar to Python: The Dynamic!

Migrating from matlab to python
Migrating from matlab to pythonMigrating from matlab to python
Migrating from matlab to pythonActiveState
 
Basic Python Programming: Part 01 and Part 02
Basic Python Programming: Part 01 and Part 02Basic Python Programming: Part 01 and Part 02
Basic Python Programming: Part 01 and Part 02Fariz Darari
 
Python for scientific computing
Python for scientific computingPython for scientific computing
Python for scientific computingGo Asgard
 
Python and Oracle : allies for best of data management
Python and Oracle : allies for best of data managementPython and Oracle : allies for best of data management
Python and Oracle : allies for best of data managementLaurent Leturgez
 
Profiling and optimization
Profiling and optimizationProfiling and optimization
Profiling and optimizationg3_nittala
 
R for Pirates. ESCCONF October 27, 2011
R for Pirates. ESCCONF October 27, 2011R for Pirates. ESCCONF October 27, 2011
R for Pirates. ESCCONF October 27, 2011Mandi Walls
 
Functions, List and String methods
Functions, List and String methodsFunctions, List and String methods
Functions, List and String methodsPranavSB
 
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...DRVaibhavmeshram1
 
An Overview Of Python With Functional Programming
An Overview Of Python With Functional ProgrammingAn Overview Of Python With Functional Programming
An Overview Of Python With Functional ProgrammingAdam Getchell
 
Types and Immutability: why you should care
Types and Immutability: why you should careTypes and Immutability: why you should care
Types and Immutability: why you should careJean Carlo Emer
 
Erlang/OTP for Rubyists
Erlang/OTP for RubyistsErlang/OTP for Rubyists
Erlang/OTP for RubyistsSean Cribbs
 
Well Grounded Python Coding - Revision 1 (Day 1 Slides)
Well Grounded Python Coding - Revision 1 (Day 1 Slides)Well Grounded Python Coding - Revision 1 (Day 1 Slides)
Well Grounded Python Coding - Revision 1 (Day 1 Slides)Worajedt Sitthidumrong
 
Well Grounded Python Coding - Revision 1 (Day 1 Handouts)
Well Grounded Python Coding - Revision 1 (Day 1 Handouts)Well Grounded Python Coding - Revision 1 (Day 1 Handouts)
Well Grounded Python Coding - Revision 1 (Day 1 Handouts)Worajedt Sitthidumrong
 

Similar to Python: The Dynamic! (20)

Migrating from matlab to python
Migrating from matlab to pythonMigrating from matlab to python
Migrating from matlab to python
 
Basic Python Programming: Part 01 and Part 02
Basic Python Programming: Part 01 and Part 02Basic Python Programming: Part 01 and Part 02
Basic Python Programming: Part 01 and Part 02
 
Python for scientific computing
Python for scientific computingPython for scientific computing
Python for scientific computing
 
Python slide
Python slidePython slide
Python slide
 
Python and Oracle : allies for best of data management
Python and Oracle : allies for best of data managementPython and Oracle : allies for best of data management
Python and Oracle : allies for best of data management
 
Profiling and optimization
Profiling and optimizationProfiling and optimization
Profiling and optimization
 
R for Pirates. ESCCONF October 27, 2011
R for Pirates. ESCCONF October 27, 2011R for Pirates. ESCCONF October 27, 2011
R for Pirates. ESCCONF October 27, 2011
 
Functions, List and String methods
Functions, List and String methodsFunctions, List and String methods
Functions, List and String methods
 
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
 
An Overview Of Python With Functional Programming
An Overview Of Python With Functional ProgrammingAn Overview Of Python With Functional Programming
An Overview Of Python With Functional Programming
 
Types and Immutability: why you should care
Types and Immutability: why you should careTypes and Immutability: why you should care
Types and Immutability: why you should care
 
Intro to Python
Intro to PythonIntro to Python
Intro to Python
 
Charming python
Charming pythonCharming python
Charming python
 
Python for dummies
Python for dummiesPython for dummies
Python for dummies
 
Erlang/OTP for Rubyists
Erlang/OTP for RubyistsErlang/OTP for Rubyists
Erlang/OTP for Rubyists
 
Intro
IntroIntro
Intro
 
Well Grounded Python Coding - Revision 1 (Day 1 Slides)
Well Grounded Python Coding - Revision 1 (Day 1 Slides)Well Grounded Python Coding - Revision 1 (Day 1 Slides)
Well Grounded Python Coding - Revision 1 (Day 1 Slides)
 
Well Grounded Python Coding - Revision 1 (Day 1 Handouts)
Well Grounded Python Coding - Revision 1 (Day 1 Handouts)Well Grounded Python Coding - Revision 1 (Day 1 Handouts)
Well Grounded Python Coding - Revision 1 (Day 1 Handouts)
 
Python cheat-sheet
Python cheat-sheetPython cheat-sheet
Python cheat-sheet
 
Intro to Python
Intro to PythonIntro to Python
Intro to Python
 

More from Omid Mogharian

Privacy in Computer Vision
Privacy in Computer Vision Privacy in Computer Vision
Privacy in Computer Vision Omid Mogharian
 
The journey to Private AI, where Privacy-Preserving ML meets DLT
The journey to Private AI,  where Privacy-Preserving ML meets DLTThe journey to Private AI,  where Privacy-Preserving ML meets DLT
The journey to Private AI, where Privacy-Preserving ML meets DLTOmid Mogharian
 
Blockchain, a disappointing tech talk
Blockchain,  a disappointing tech talkBlockchain,  a disappointing tech talk
Blockchain, a disappointing tech talkOmid Mogharian
 
Data science team (new version)
Data science team (new version)Data science team (new version)
Data science team (new version)Omid Mogharian
 
Distributed File System and Why It Matters.
Distributed File System and Why It Matters.Distributed File System and Why It Matters.
Distributed File System and Why It Matters.Omid Mogharian
 
Data science team, a practice to setup
Data science team, a practice to setupData science team, a practice to setup
Data science team, a practice to setupOmid Mogharian
 
Hadoop essential setup
Hadoop essential setupHadoop essential setup
Hadoop essential setupOmid Mogharian
 

More from Omid Mogharian (8)

Privacy in Computer Vision
Privacy in Computer Vision Privacy in Computer Vision
Privacy in Computer Vision
 
The journey to Private AI, where Privacy-Preserving ML meets DLT
The journey to Private AI,  where Privacy-Preserving ML meets DLTThe journey to Private AI,  where Privacy-Preserving ML meets DLT
The journey to Private AI, where Privacy-Preserving ML meets DLT
 
Blockchain, a disappointing tech talk
Blockchain,  a disappointing tech talkBlockchain,  a disappointing tech talk
Blockchain, a disappointing tech talk
 
How big is big data?
How big is big data?How big is big data?
How big is big data?
 
Data science team (new version)
Data science team (new version)Data science team (new version)
Data science team (new version)
 
Distributed File System and Why It Matters.
Distributed File System and Why It Matters.Distributed File System and Why It Matters.
Distributed File System and Why It Matters.
 
Data science team, a practice to setup
Data science team, a practice to setupData science team, a practice to setup
Data science team, a practice to setup
 
Hadoop essential setup
Hadoop essential setupHadoop essential setup
Hadoop essential setup
 

Recently uploaded

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
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...Miguel Araújo
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
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 organizationRadu Cotescu
 
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 productivityPrincipled Technologies
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 

Recently uploaded (20)

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
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...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
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
 
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
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

Python: The Dynamic!

  • 1. csccit2011 University of Tabriz by Omid Mogharian omid.mogharian@gmail.com
  • 2. outline •  •  •  •  •  •  What is python? Why python? Introduction to python Python programming: Tips & Tricks More on python Scienti"c module
  • 3. What is python? •  Python is a Interpreted, Interactive, Portable, Functional / Object-Oriented programing language. •  Invented by “Guido Van Rossum” in 1991. •  free and open source develop by “python software foundation”, available at www.python.org •  "nal release: Python 2.7.2 , python 3.2.2
  • 4. Why python? •  •  •  •  •  •  Multi purpose design (web, os. application ,scienti"c, …) Cross platform (wide portability) Both Functional & O.O programming Rapid in Prototyping, strong in enterprise system Integrate with other languages (c/c++, java, fortran, …) Dynamic, Extensible, readable.
  • 5. Why python? •  •  •  •  •  •  Many library and module Easy to use (simple & familiar syntax ,few restrictions & rules) Automatic memory management (Garbage Collector) Good element (Dictionary, List, … ) Good built-in algorithms (hashing , sorting , …) Many companies & institutions around the world use python (Google, Yahoo, NASA, YouTube, FriendFeed , …)
  • 6. Introduction to python •  Start with python –  Set up •  Linux , mac os X. and most operating systems have Python •  For windows, download python installer and run it. –  Run •  Use interactive mode by type “python” in Terminal •  “python ["lename].py” run python code "les –  lDE •  Every text editor with a little understanding of code : notepad++,Gedit, jedit, … •  IDLE python editor releasing by “python.org” •  KOMODO is a good one!
  • 7. Introduction to python •  Strings –  Concatenation “Hello” + “World” -> “HelloWorld” –  Repetition “Tabrizu” * 3 -> “TabrizuTabrizuTabrizu” –  Indexing “Tabrizu”[2] ->“b” , “Tabrizu”[-2] -> “z” –  Slicing “Tabrizu”[1:4] -> “abri” –  Size len(“Tabrizu”)-> 7 –  Comparison “Tabrizu” > “tabrizu” -> fasle –  Search “u” in “Tabrizu” -> true
  • 8. Introduction to python •  Lists –  e.g. aList = [631, “python”, [331, “tb”]] –  Like indexable arrays, not like linked list –  Same operators as for strings –  More operations append(), insert(), pop(), reverse() and sort() •  Sets –  e.g. aSet=set([‘tabrizu’,’ploytechnic’,’tehran’]) –  add(x), remove(x), discard(x), pop(), clear(), issubset(), issuperset(), … –  Union ‘|’, intersection ‘&’, di#erence ‘#’
  • 9. Introduction to python •  Tuples   –  e.g. aTuple = (631, “python”, (611, “SA”)) –  Unlike  lists  and  like  strings  &  set  tuples  are  immutable   •  Dic6onaries     –  e.g. adict= {“tabriz”:”python”,”tehran”:”Java”} –  Lookup    adict[“tabriz”] -> ”python”   –  Insert    adict[“value”] = 100   –  Delete    del adict[“value”] –  Presencie    adict.has_key(“tehran”) -> True –  Itera6ons    keys(), values(), items()
  • 10. Introduction to python •  Variables –  No need to declare, Not typed but need to initialize –  Almost everything can be assigned to a variable (functions, modules, classes) –  All variable are reference (a=b means a & b refer to same object) •  Flow of Control –  if condition : statements (elif condition : statements) [else : statements] –  while condition : statements [else : statements] –  for var in sequence : statements [else : statements] –  Break & Continue
  • 11. Introduction to python •  Functions –  def FunctionName(arg1, arg2, ...): Statements return (expression) •  Classes –  class ClassName(BaseClass1, BaseClass2...) : Statements –  x = ClassName() creates a new instance
  • 12. Introduction to python •  A simple example
  • 14. Introduction to python > this is a static function!
  • 17. Introduction to python > AttributeError: cls instance has no attribute 'name’!
  • 18. Introduction to python > len of prob is 1 and this is a external function!
  • 19. Introduction to python > this is overwrite function!
  • 20. Introduction to python > <__main__.cls instance at 0x10aeac440>!
  • 21. Introduction to python •  Modules –  Usage:  e.g.    import  datetime –  Partial usage: e.g. from datetime import time –  bult-in , installed and beside of code .py "les modules •  example > Python test.py jim! > Hello jim!
  • 22. Tips & Tricks None and empty cheaking   my_object = 'Test' # True example! # my_object = '' or my_object = None # False example! if len(my_object) > 0:! !print 'my_object is not empty'! ! if len(my_object): # 0 will evaluate to False! print 'my_object is not empty’! if my_object != '':! print 'my_object is not empty’! ! if my_object: # an empty string will evaluate to False! print 'my_object is not empty'
  • 23. Tips & Tricks Divition and $oat numbers   5/2 5.0/2 float(5)/2 5//2 ! # # # # Returns Returns Returns Returns 2! 2.5! 2.5! 2! from __future__ import division! 5/2 # Returns 2.5! 5.0/2 # Returns 2.5! float(5)/2 # Returns 2.5! 5//2 # Returns 2
  • 24. Tips & Tricks In one line!   list= [’tabriz', ’tehran', ’shiraz']! print 'The three are: %s.' % ', '.join(list)! # print the tree are tabriz, tehran, shiraz! ! validation= True if list else 'Test is False'! # validation is True! ! ! ! ! !
  • 25. Tips & Tricks lambda   def add(a,b): return a+b! add2 = lambda a,b: a+b squares = map(lambda a: a*a, [1,2,3,4])! Squares = a*a for a in [1,2,3,4]! squares is now [1,4,9,16]
  • 26. Tips & Tricks Lambda & one line for   numbers = [1,2,3,4,5]! numbers_under_4 = filter(lambda x: x < 4, numbers)! numbers_under_4 = [number for number in numbers if number < 4]! # numbers_under_4 = [1,2,3]! ! squares = map(lambda x: x*x, filter(lambda x: x < 4, numbers))! squares = [number*number for number in numbers if number < 4]! # square is now [1,4,9]
  • 27. Tips & Tricks one line for Vs nested for   print [(x, y, x * y) for x in (0,1,2,3) for y in (0,1,2,3) if x < y]! # prints [(0, 1, 0), (0, 2, 0), (0, 3, 0), (1, 2, 2), (1, 3, 3), (2, 3, 6)]! ! for x in (0,1,2,3):! for y in (0,1,2,3):! if x < y:! print (x, y, x*y),! # prints (0, 1, 0) (0, 2, 0) (0, 3, 0) (1, 2, 2) (1, 3, 3) (2, 3, 6)! !
  • 28. Tips & Tricks Lambda …   numbers = [1,2,3,4,5]! ! result = reduce(lambda a,b: a*b, numbers)! ! result = 1! for number in numbers:! !result *= number! ! # result is now 120
  • 29. Tips & Tricks ….   ! ! strings = ['a', 'b', 'c', 'd', 'e’]! for index, string in enumerate(strings):! print index, string,! # prints '0 a 1 b 2 c 3 d 4 e’! ! numbers = [1,10,100,1000,10000]! if any(number < 10 for number in numbers):! print 'Success’! # Output: 'Success!'
  • 30. Tips & Tricks ….   ! ! if all(number < 10 for number in numbers):! print 'Success!’! # Output: (nothing)! ! ! test = True! result = ['Test is False','Test is True'][test]! # result is now 'Test is True’!
  • 31. Tips & Tricks Default value   ! def function(item, stuff = []):! stuff.append(item)! print stuff! ! function(1)! # prints '[1]’! function(2)! # prints '[1,2]' !!!! ! ! !
  • 32. Tips & Tricks Arbitrary  Numbers  of  Arguments   ! ! ! def do_something_else(a, b, c, *args, **kwargs):! print a, b, c, args, kwargs! ! ! do_something_else(1,2,3,4,5,6,7,8,9, timeout=1.5)! # prints '1, 2, 3, (4, 5, 6, 7, 8, 9), {"timeout": 1.5}'!
  • 33. Tips & Tricks Decorator   def decorator1(func):! return lambda: func() + 1! def decorator2(func):! def print_func():! print func()! return print_func! ! @decorator2! @decorator1! def function():! return 41! function()! ! function = decorator2(decorator1(function))! # prints '42'
  • 34. Tips & Tricks ! Dict  /  Object   ! class mydict(dict):! def __getattr__(self, attr):! if super(mydict,self).has_key(attr):! return super(mydict,self).__getitem__(attr)! ! def __setattr__(self,attr,value):! super(mydict,self).__setattr__(attr,value)! ! adict= {‘apple’:1 ,’banana’:2 , ‘peach’:3}! mdict=mydict(adict)! mdict.orange=10! print mdict.apple, mdict.orange , mdict[‘banana’] , mdict! # prints '1 ! 10 2 {‘apple’:1 ,’banana’:2 , ‘peach’:3 , ‘orange’:10}’!
  • 35. More on python •  Commercial Usage –  –  –  –  MVC Web programming via web server modules: Tornado, cherrypy ,… Mobile programming :PyObjC, ASE , … Easily connect to famous DB: MSSQL, Mysql , Oracle,… designed for non-relational DB linke Cassandra, MongoDB, CouchDB. What is Non-relational DB!? •  No relation between data, Provide list, vector, nested data "elds •  No force schema & type •  Java script base syntax instead of SQL •  Document-oriented , Key-Value and Object-oriented database
  • 36. More on python •  Integrating Python With Other Languages –  SWIG - generate extension module from your .h "les –  F2PY - Fortran to Python Interface Generator –  Lython (archived page) - Lisp front-end for Python –  JPype Java for CPython •  Python interpreters –  Cpython a bytecode interpreter (Orginal) –  –  –  –  PyPy  a  JIT  Compiler,  more Speed  &  efficiency   ShedSkin  a  Python  to  C++  programming  language  compiler   Jython a Java implemented of Python   ironpython a .net implemented of python
  • 37. Scienti"c module •  Numeric  Module   –  NumPy      Numerical  Python  adds  a  fast,  compact,  mul6dimensional  array   facility  to  Python   –  SciPy    Includes  modules  for  linear  algebra,  op6miza6on,  integra6on,   special  func6ons,  sta6s6cs,  and  others.     –  OpenOpt  a  framework  for  numerical  op6miza6on  and  systems  of  linear/ non-­‐linear  equa6ons.     –  ALGLIB    numerical  analysis  library  in  C++  and  C#,  with  Python  interfaces.     –  SpaceFuncs  -­‐  a  tool  for  2D,  3D,  N-­‐dimensional  geometric  modeling  with   possibili6es  of  parametrized  calcula6ons,  numerical  op6miza6on  and   solving  systems  of  geometrical  equa6ons  with  automa6c  differen6a6on.    
  • 38. Scienti"c module •  Algorithm  Module     –  Mlpy    Machine  Learning  Python  and  high-­‐performance  Python   module  for  Predic6ve  Modeling   –  SciPy  for  signal  and  image  processing,  gene6c  algorithms   –  graph-­‐tool    A  python  module  for  efficient  analysis  of  graphs  (aka.   Networks)   –  Pyevolve is evolutionary algoritm. Machin learning.
  • 39. Scienti"c module •  Grid  CompuAng  Module   –  PyGlobus  Globus  toolkit  bindings  for  python     –  PEG    Python  Extensions  for  the  Grid     –  Ganga    Grid  job  management  interface.     –  DIANE  Python  user-­‐level  middleware  layer  for  Grids.        
  • 40. Scienti"c module •  Other  ScienAfic  Module     –  ScienAficPython  is  a  collec6on  of  Python  scien6fic  modules   –  Thuban  is  a  Python  Interac6ve  Geographic  Data  Viewer     –  Matplotlib    hp://matplotlib.sourceforge.net/  -­‐  matplotlib  is  a   python  2D  plo]ng  library     –  Biopython  -­‐  a  set  of  freely  available  tools  for  biological   computa6on  and  bioinforma6cs.   –  PyMol    3D  molecular  viewer  
  • 41. Scienti"c module •  Exmaple  Usige  Pyevolve –  Installing pakages > apt-­‐get  install  python-­‐setuptools! > easy_install  pyevolve! Or instal .egg pakage > easy_install  /downloads/downloaded_package.egg  !
  • 42. Scienti"c module •  Exmaple  Usige  Pyevolve
  • 43. Refrences •  Python  Homepage      hJp://www.python.org/   •  Python  wiki      hJp://wiki.python.org/   •  Google  Code  University      hJp://code.google.com/edu/   •  Python    documentaAon     hJp://docs.python.org/
  • 44. Thanks  for  your  aJenAon