Docsity

Python - An Integrated Computational and Problem Solving | COMP 140, Exams of Computer Science

Partial preview of the text

Download Python - An Integrated Computational and Problem Solving | COMP 140 and more Exams Computer Science in PDF only on Docsity!

python.

RICE UNIVERSITY • COMP 140 A N E X P E R I M E N TA L TA L K F O R A N E X P E R I M E N TA L C O U R S E A U G 2 6 & 2 7 , 2 0 0 8 Daniel Sandler dsandler@rice http://www.cs.rice.edu/~dsandler/python/

Me, circa 2000

(very busy)

Many tasks, many languages OOP, popular pretty, powerful useful C++ Scheme perl (work) (fun) (utility belt)

then,

I discovered

a language

called

then,

python!

I discovered

a language

called

Me, circa 2006 (lazy)

Me, circa 2008 (still lazy) (aww!)

Stuff I need to do:

  • Sketch new ideas quickly
  • Hack together analysis tools in the field
  • Turn prototypes into final research code
  • Build web applications for course & departmental use

2. Seriously, tell us about python already.

python is…

  • handy
  • smart
  • fun
  • helpful
  • pretty

handy

  • built-in libraries, everything I might need - data structures, concurrency - object serialization - cross-platform gui - sockets/smtp/mime/http/imap/xml/rpc/etc. - posix stuff, compression - regexps, unicode - cgi/httpd
  • other modules: databases, scientific computing, image processing, crypto, …

fun

  • every Python is an interactive workshop
  • the “read-eval-print loop” (REPL) - ask a question, get an answer - the only calculator you’ll ever need - experiment with live objects - (no waiting for the compiler)

helpful

  • Every object, class, function, module is self- documenting - “Carry your documentation with you” - (It’s actually a property on the object)
  • Essential, don’t-leave-home-without-them functions to use in the REPL: help( foo ) dir( foo )