150 likes | 252 Vues
Biju Chacko <biju_chacko@vsnl.net> BC Consulting. An Introduction to Python. Introduction. Who am I (or “Why should you listen to me ?”) Disclaimer (or “Why you shouldn't listen to me!”) :-) Please present questions at the end of the talk. Scope of the Talk. Not a Tutorial.
E N D
Biju Chacko <biju_chacko@vsnl.net> BC Consulting An Introduction to Python
Introduction • Who am I (or “Why should you listen to me ?”) • Disclaimer (or “Why you shouldn't listen to me!”) :-) • Please present questions at the end of the talk.
Scope of the Talk • Not a Tutorial. • Is not a substitute for the manual. • Give you a “feel” for the language and it's features. • Inspire you to give a shot. (hopefully) ;-)
A Little History • What is Python? • an interpreted, interactive, object-oriented programming language. • Who wrote Python? • Guido van Rossum in 1990 in Amsterdam
How can you use Python? • Standard Interpreted Scripting Language • CGI • mod_python • Embedded Command Langauge • JVM (with full access to Java Classlib)
Hello World • Basic Hello World: #!/usr/bin/env python print 'Hello World!' • GUI Hello World • See hello.py
Structure of the Language • Dynamic Typing • Rich set of Data Structures: • Lists • Tuples • Dictionaries • Exception Handling • Classes
Neat Stuff in the Standard Library • Too much to list here • Pickle: object persistence • Regex • Threading and Synchonization (warning!) • GUI building with Tk.
Neat Stuff in the Standard Library (contd.) • Internet tools • Urllib2: open arbitrary urls • Clients: ftp, pop, imap, smtp, telnet, nntp and http protocols. • Http server • Socket server/client • Buzzword-compliancy • XML: SAX and DOM xml parsers • Xml-rpc client
Neat Stuff that isn't in the Standard Library • PyGTK: easy GUI building, supports glade. • WxPython: cross platform GUI (Windows, *nix, MacOS) • Scintilla: cross platform Editing component.
Notable Python Projects • Zope: the mother of all CMSes • The late lamented CML2 • Many of Red Hat's admin and installation tools
Pros and Cons of Python • Pros • Clear readable syntax • Rich library • High productivity • Maintainability • Cross Platform
Pros and Cons of Python (contd.) • Cons • Syntactic significance of indentation. • No CPAN • No standard DB access library like Perl::DBI • Slower than compiled languages • My opinion: Python vs Perl
Resources • http:///www.python.org • Why Python? By ESR • http://www.linuxjournal.com/article.php?sid=3882 • Perl Hacker compares Perl & Python • http://www.perl.com/pub/a/language/versus/python.html