Extensive standard libraries and third party modules for virtually every task.
Extensions and modules easily written in C, C++ (or Java for Jython, or .NET languages for IronPython)
Embeddable within applications as a scripting interface
Python was conceived in the late 1980s and its implementation was started in December 1989
Guido van Rossum (Python's principal author, and his continuing central role in deciding the direction of Python is reflected in the title given to him by the Python community, Benevolent Dictator for life(BDFL))
Python 2.0 was released on 16 October 2000, with many major new features including a full garbage collector
Python 3.0 (also known as Python 3000 or py3k was released on 3 December 2008 after a long period of testing.
Python has twice been awarded as TIOBE Programming Language of the Year (2007, 2010), which is given to the language with the greatest growth in popularity over the course of the year (as measured by the TIOBE index)
not # logical/boolean not returns True/False == != < > <= >= # equality, relational
is # object identity is not
** # power (x^y)
// # floor division (truncates to integer)
float(123) float('123.0') # convert integer/string to float int(1.5) # convert to integer (truncate) bool(x) # convert to boolean hex(15) # convert to string in hex format int('101',2) # convert to int from binary number in string
Expression statements are used (mostly interactively) to compute and write a value, or (usually) to call a procedure (a function that returns no meaningful result; in Python, procedures return the value None).
Assert statements are a convenient way to insert debugging assertions into a program.
Pass is a null operation — when it is executed, nothing happens. It is useful as a placeholder when a statement is required syntactically, but no code needs to be executed.
Deletion of a target list recursively deletes each target, from left to right.
Print evaluates each expression in turn and writes the resulting object to standard output .
Break may only occur syntactically nested in a for or whileloop, but not nested in a function or class definition within that loop.
Continue may only occur syntactically nested in a for or while loop, but not nested in a function or class definition or finally clause within that loop. It continues with the next cycle of the nearest enclosing loop.
Import statements are executed in two steps: (1) find a module, and initialize it if necessary; (2) define a name or names in the local namespace (of the scope where the import statement occurs).
The global statement is a declaration which holds for the entire current code block.
*Extensive support for HTML and XML. *E-mail processing. *Processing RSS feeds. *Support for many other Internet protocols.
*MySQL, Oracle, MS SQL Server, PostgreSQL, SybODBC, and others are available for free download.
Scientific and Numeric
*Bioinformatics *Python course in Bioinformatics *Physics
C/C++ is a very structured language, its syntax is not as exible as scripting languages such as Perl.
C/C++ version requires more lines of code compared with Perl.
improperly written C/C++ programs are vulnerable to memory leak problems
Allows embedding of inline PHP code inside HTML documents that makes it very convenient to embed small snippets of PHP code.
PHP supports the object-oriented paradigm, most of its functionalities are provided through functions.
Java syntax is very structured and thus are not as fexibleas scripting languages like Perl.
Java itself is not just an interpreter, it is a virtual machine over which programmers are totally abstracted from the underlying operating system platforms
How A Perl Program Is Executed Preprocessing An optional preprocessing stage transforms the source file to the final form. Tokenizing The source le is broken down into tokens. This process is called tokenization (or Lexical analysis). Whitespaces are removed. Token is the basic unit that makes up a statement. By tokenizing the input parsing is becoming easier because all further processing are carried out on tokens,independent of whitespace.
Parsing & Optimization (Compilation) Parsing involves checks to ensure the program being executed conforms to the language specication and builds a parse tree internally which describes the program in terms of microoperations internal to Perl (opcode).
* In Perl, integers can be expressed in decimal (base 10), hexadecimal (base 16) or octal (base 8) notation. * Integers cannot be delimited by commas or spaces like 10,203,469 or 20 300. * Exponents (base 10) can also be specied by appending the letter .”e” and the exponent to the real number portion. e.g. 2e3 is equivalent to 2 x 103 = 2000.
* Is a special data structure. It is similar to an array except that the index is not an integer, a string is used for indexing, and is known as a key. The key is conceptually like a tag which is attached to the corresponding value. The key and the value forms a pair (key-value pair).
Arithmetic operators manipulate on numeric scalar data. Perl can evaluate an arithmetic expression, in a way similar to our daily-life mathematics. Operator Description + Addition operator - Subtraction operator * Multiplication operator / Division operator % Modulus operator + Positive sign - Negative sign ++ Autoincrement operator -- Autodecrement operator ** Exponentiation operator
Comparison operators are used to compare two pieces of scalar data, e.g. alphabetically or numerically and returns a Boolean value. In Perl, there are two sets of comparison operators. The rst set compares the operands numerically: Operator Description < less than > greater than <= less than or equal to >= greater than or equal to <=> general comparison
The second set compares the operands stringwise: Operator Description lt less than gt greater than le less than or equal to ge greater than or equal to cmp general comparison
Equality operators compares two pieces of scalar data and returns if their values are identical. They may be considered special cases of comparison operators. Operator Description == equal (numeric comparison) != not equal (numeric comparison) eq equal (stringwise comparison) ne not equal (stringwise comparison)
Bitwise operators provide programmers with the capability of performing bitwise calculations. Operator Description << Binary shift left >> Binary shift right & Bitwise AND | Bitwise OR ˆ Bitwise XOR ~ Bitwise NOT
Logical operators can be used to do some Boolean logic calculations. Operator Description || or Logical OR && and Logical AND ! not Logical NOT, i.e. negation xor Logical XOR.Exclusive OR
test1 test2 and && or || xor true true true true false true false false true true false true false true true false false false false false Test not ! true false false true Table 4.1: Truth table of various Perl logical operators
String manipulation operators manipulate on strings. Operator Description x String repetition operator . String concatenation operator