Tuesday, May 29, 2018

Introduction to Python


What is Python?
===============

- an interpreted language (a software installed on your computer reads your
  python code)
    * although Python is an interpreted language, it uses sometimes compiled
      code (*.pyc) to speed up execution
- not necessarily a compiled language (converts human-readable code into
  byte-code and relay it directly to hardware)
- programming language used for automation
    > search and replace
    > for small database
    > specialized GUI application
    > simple game
    > etc..
- not well suited for GUI applications or games
- cross-platform: can be used in Windows or *NIX systems

Features of Python
==================

- offers much more error checking than C
- has high-level data types
    > flexible arrays
    > dictionaries
- appicable on more areas than awk or perl
- allows to split programs into modules
    > file I/O
    > system calls
    > sockets
    > GUI toolkits such as Tk
- interpreted language: no complition and linking needed
- interpreter can be used interactively (just enter `python` in cli)
- programs written in Python are typically shorter than C/C++/Java counterparts
    > high-level data types can be expressed in a single statement
    > grouping is down by indentation instead of beginning and ending brackets
    > no variable or argument declaration necessary
- extensible (modules can be added)

Getting Help
============

- python contains documentations and manual pages
- ways on getting useful information:
    a. open up web location to browse HTMl docs: # pydoc -p 9999
    b. prints functions/names define in a module: `dir(mod_name)` or dir
       (mod1.mod2)
    c. open manual pages: `help(mod_name)`
    d. interactive help session: `help()`

No comments:

Post a Comment