Download دانلود فایل pptx لینک مستقیم

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
‫‪Python‬‬
‫طراحی و پیاده سازی زبانهای برنامهسازی‬
‫‪‬علیرضا اخوان پور‬
‫‪‬سینا پدیدار‬
‫‪‬امیر آهنگی‬
‫‪‬سرکار خانم مهندس معزکریمی‬
www.python.org
‫جالب است بدانید که‪:‬‬
‫‪ ‬نام پایتون از برنامه مورد عالقههی سهازن‌هی ن مهونی پهایتون کهه یه برنامهه ی‬
‫کمه ه ه ه ه ه ه ه ه ه ه ه ه ه ه هه‌ی ان ه ه ه ه ه ه ه ه ه ه ه ه ه ه ه ه به ه ه ه ه ه ه ه ه ه ه ه ه ه ه ههود ر ته ه ه ه ه ه ه ه ه ه ه ه ه ه ه ههه ه ه ه ه ه ه ه ه ه ه ه ه ه ه ه هه‌ه اس ه ه ه ه ه ه ه ه ه ه ه ه ه ه ه ه !!‬
‫َ‬
‫‪ ‬توسط خودو ان روسوم )به ه ن‌ی‪ (Guido van Rossum :‬در سال ‪ ۱۹۹۱‬در‬
‫کشور ه ن‌ طراحی ‌‪.‬‬
‫?‪What’s in a name‬‬
 O-O rapid prototyping language
 Not just a scripting language
 Not just another Perl
 Easy to learn, read, use
 Extensible (add new modules)
◦ C/C++/Fortran/whatever
◦ Java (through Jython)
 Embeddable in applications
What is Python?
‫‪ ‬متن بازو اپن سورس )‪(OSI Certified‬‬
‫◦ دارای کپ رای (‪ , )©CopyRight‬اما استفاده مح‌ود نم ود‬
‫◦ ‪owned by independent non-profit, PSF‬‬
‫‪ ‬پشتیبان کاربران‬
‫◦ راوانی منابع و کتب موزش‬
‫‪ ‬طراحی ساده‪ ,‬فراگیری آسان‬
‫◦ خوانایی ساده همچو به ک‌ (”‪)“pseudo-code‬‬
‫◦ مناسب به عنوان اولین زبان‬
‫◦ مناسب به عنوان خرین زبان‬
‫‪Touchy-feely properties‬‬
)Portable( ‫ قاب ی قابل حمل‬
Unix/Linux, Windows, Mac, PalmOS, WindowsCE, RiscOS, VxWorks, QNX, ◦
OS/2, OS/390, AS/400, PlayStation, Sharp Zaurus, BeOS, VMS…
(interpreted byte code)‫ کامپایل به ک‌ بای تفسیر‬
compilation is implicit and automatic ◦
‫ م‌یری خودکار حا ظه‬
reference counting for most situations ◦
GC added for cycle detection ◦
“Safe”: no core dumps due to your bugs 
High-level properties
)rapid prototyping ( ‫نمونه سازی سریع‬
(client and server side) ‫استفاده در برنامه نوی وب‬
)steering scientific applications( ‫مناسب برای برنامههای ع م‬
)extension language(‫زبان الحاقی‬
XML ‫پردازش‬
database applications
GUI applications
‫موزش‬
What is it used for?








Google (various projects)
 NASA (several projects)
 NYSE (one of only three languages "on the floor")
 Industrial Light & Magic (everything)
 Yahoo! (Yahoo mail & groups)
 RealNetworks (function and load testing)
 RedHat (Linux installation tools)
 LLNL, Fermilab (steering scientific applications)
 Zope Corporation (content management)
 ObjectDomain (embedded Jython in UML tool)
 Alice project at CMU (accessible 3D graphics)
 More success stories at www.pythonology.com

Who is using it?







Everything is an object
Packages, modules, classes, functions
Exception handling
Dynamic typing, polymorphism
Static scoping
Operator overloading
Indentation for block structure (‫)تو ر ت ی برای ساختار ب وک‬
◦ Otherwise conventional syntax
Language properties





Numbers: int, long, float, complex
Strings, Unicode: immutable
Lists and dictionaries: containers
Other types for e.g. binary data, regular expressions, introspection
Extension modules can define new
“built-in” data types
High-level data types

XML
◦ DOM, expat
◦ XMLRPC, SOAP, Web Services

Relational databases
◦ MySQL, PostgreSQL, Oracle , ODBC, Sybase, Informix




Java (via Jython)
Objective C
COM, DCOM (.NET too)
Many GUI libraries
◦ cross-platform
 Tk, wxWindows, GTK, Qt
◦ platform-specific
 MFC, Mac (classic, Cocoa), X11
Interfaces to...
 Easier to learn
◦ very important for infrequent users
 More readable code
 More maintainable code
 Fewer “magical” side effects
 More “safety” guarantees
 Better Java integration
Compared to Perl

Code up to 5 times shorter
◦ and more readable



Dynamic typing
Multiple inheritance, operator overloading
Quicker development
◦ no compilation phase
◦ less typing

Yes, it may run a bit slower
◦ but development is much faster
◦ and Python uses less memory (studies show)
Similar (but more so) for C/C++
Compared to Java





Seamless integration with Java
Separate implementation
Implements the same language
Different set of standard modules
differences in “gray areas”
◦ e.g. some different introspection calls
◦ different command line options, etc.
Jython
‫زبان پایتون بسیار بیه به زبان انسان اس‬
‫برنامه ‪Hello World‬را که اولین برنامه ساده می با ‌ را در دو زبان ‪C‬و ‪Python‬مقایسه‬
‫کنی‌ ‪:‬‬
‫)(‪int main‬‬
‫{‬
‫;)" ‪printf("Hello World‬‬
‫;‪return 0‬‬
‫}‬
‫اما بوسی ه پایتون در ی‬
‫ایل متن بنویسی‌‬
‫"!! ‪print "Hello World‬‬
‫و با دستور ‪ python hi.py‬اونو اجرا کنی‌ ‪.‬‬
‫‪Example code‬‬
Interactive
 Compiles directly to Java bytecode
 Import Java classes directly
 Subclass Java classes

◦ pass instances back to Java
Java beans integration
 Can compile into Java class files

Jython's Java integration
def gcd(a, b):
"greatest common divisor"
while a != 0:
a, b = b%a, a
# parallel assignment
return b
Example function
class Stack:
"A well-known data structure" # doc string
def __init__(self): # constructor
self.items = []
def push(self, x):
self.items.append(x) # the sky is the limit
def pop(self):
x = self.items[-1] # what happens if it’s empty?
del self.items[-1]
return x
def empty(self):
return len(self.items) == 0
Example class
◦ www.python.org - Python home site
◦
◦
◦
◦

 documentation, downloads, community, PSF
www.pythonology.org - success stories
www.artima.com/intv - interview with GvR
www.zope.org - Zope community site
www.zope.com - Zope corporate site
Python Conferences (see www.python.org):
◦ PyCon DC March 26-28 Washington, DC
 on-line registration ends today ($200)
◦ Python UK April 2-3 Oxford, England
◦ EuroPython June 25-27 Charleroi, Belgium
◦ Python11 at OSCON July 7-11 Portland, OR
References and plugs
:‫ منابع‬
‫‪‬‬
‫اطالعات ب شتر در زمینهی ‪Google App Engine‬‬
‫منابع مطالعاتی ارس و ان‬
‫اسالی‌ موزش به همراه توضیحات تایپ ‌ه‬
‫‪www.AlirezaWeb.com‬‬
‫‪‬‬
‫موزش ارس و رومهای پرسش و پاسخ‬
‫‪www.barnamenevis.org‬‬
‫‪www.pylearn.com‬‬
‫‪‬‬
‫سای رسم پایتون‬
‫‪‬‬
‫‪‬‬
‫‪www.python.org‬‬
‫!‪More information‬‬