Python
  Home arrow Python arrow Page 3 - Python The Other Scripting Language That Starts With
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PYTHON

Python The Other Scripting Language That Starts With
By: Evelyn Mitchell
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 14
    2002-12-24


    Table of Contents:
  • Python The Other Scripting Language That Starts With
  • Hello World!
  • Python and Java
  • What is Python Bad For?

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Python The Other Scripting Language That Starts With - Python and Java
    ( Page 3 of 4 )

    Java is a full-featured programming language with a complete range of types, thread support, strong typing, and all of the other features you expect.

    Python is a scripting language. It doesn't use or offer strong typing, which is nice for prototyping but can cause problems in more complex implementations. It does offer thread support, but it isn't as rugged as Java's thread support.

    But you don't need to choose between Java and Python. Using JPython, you can write Python code that is evaluated within a Java Virtual Machine. You don't even have to take a performance penalty. In fact, there have been several reports of a marked speed increase between regular C Python and JPython because of some optimizations in the implementation of dynamic datatypes in the JPython port of Python.

    Why is Python Popular With Linux users?
    There are several reasons why Python is gaining in popularity with Linux users. Python users don't match the sheer numbers of Perl users, but users who have tried Python tend to continue using it for these simple reasons:
    • Readability. Python makes it almost impossible to write obfuscated code. White space is used to delimit blocks, ensuring obvious block structure. The syntax is clean, with a consistent calling structure for modules and functions.
    • Taste. Linux has yet to break through to on-every-desktop popularity. Those who are using it now tend to be the more sophisticated and discerning computer users. For some of them, like Eric Raymond, Python is their preferred language because it is an elegant, clean programming language. Others, like Mark Lutz, the author of Programming Python, prefer it because "Python looks designed, not accumulated".
    • Object support. Python enables you to be an object-oriented developer without paying for a heavy, system programming-level syntax like you have to pay for in a language like Java or C++.
    • Development speed. As a rapid prototyping language, with strong support for GUI toolkits like Tk and GTK, Python lets you create full-featured solutions very quickly. If those solutions suffer from performance problems, it is very easy to plug in C replacements for the performance-critical components on a piece-by-piece basis.
    • Interoperability. Linux is a great glue operating system. It is used most often in situations where you would find at least one other type of operating system, usually Windows. Python is very portable code, with interpreters available for all common, and many uncommon, operating systems. So you can develop code on Linux and deploy the same code throughout your system. You can even use it in embedded systems that support a Java Virtual Machine (JVM) by using JPython.
    • Reusability. Linux is known for its modular design at the kernel level, just as Unix is known for its many small tools. Python also uses small, well crafted components, called modules. Modules are very easy to design and use, which encourages formal and informal code libraries. Perl has the advantage in formal public code repositories, though, as there is yet no equivalent to the Comprehensive Perl Archive Network (CPAN) for Python.
    • Reliability. The Python community encourages high-quality coding standards. An example is the common practice of writing modules that contain their own test routines. These routines, which start with if __name__ == '__main__': are executed only if the module is run as a stand-alone program. If the module is called from another program, as is usually the case, this test routine is skipped.
    • No compile/link step. Python is a byte-compiled language as well as an interpreted language. This means that the first time the Python interpreter executes a program or a module, it is translated into byte code. This byte code is written to disk as .pyc. Then, when the program or module is executed again, the interpreter checks to see if there is a .pyc file with a more recent timestamp than the .py file. If one exists, it skips the byte-compilation step and reads the compiled file from disk. This can save a lot of execution time.
    • Rich class libraries. Library modules are available for most common programming tasks, including full POSIX-compliant routines, several different math libraries, support for several different GUI toolkits, support for CGI programming and HTML and XML generation and parsing, just to name a few. The standard list of modules is available at Python.org as a small part of the excellent documentation available there.
    Installing Python on Linux
    If you are running a Red Hat Linux system that uses RPM, installing Python is as simple as downloading the RPM from the Python.org Web site and typing:

    rpm -i python-1.5.2-2.i386.rpm

    Red Hat 6.0 shipped with Python 1.5.1, so you will need to update it if you have it already installed:

    rpm -u python-1.5.2-2.i386.rpm

    If you are running Debian Linux, you can download Python and some additional modules from the standard Debian distribution using apt/dselect.

    Other Linux platforms will need to compile Python from source. To do this follow the instructions in the README file in the distribution, or consult your local expert.

     
     
    >>> More Python Articles          >>> More By Evelyn Mitchell
     

       

    PYTHON ARTICLES

    - Tuples and Other Python Object Types
    - The Dictionary Python Object Type
    - String and List Python Object Types
    - Introducing Python Object Types
    - Mobile Programming using PyS60: Advanced UI ...
    - Nested Functions in Python
    - Python Parameters, Functions and Arguments
    - Python Statements and Functions
    - Statements and Iterators in Python
    - Sequences and Sets in Python
    - Python Expressions and Operators
    - Dictionaries, Variables and Statements in Py...
    - Data Types in Python
    - The Python Language
    - SSH with Twisted





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    Stay green...Green IT