Tuesday, 7 January 2014

What Can I Do with Python?

In addition to being a well-designed programming language, Python is useful for ac-complishing real-world tasks—the sorts of things developers do day in and day out. It’s commonly used in a variety of domains, as a tool for scripting other components and implementing standalone programs. In fact, as a general-purpose language, Python’s roles are virtually unlimited: you can use it for everything from website de-velopment and gaming to robotics and spacecraft control. However, the most common Python roles currently seem to fall into a few broad cat-egories. The next few sections describe some of Python’s most common applications
today, as well as tools used in each domain. We won’t be able to explore the tools mentioned here in any depth—if you are interested in any of these topics, see the Python website or other resources for more details.

Systems Programming

Python’s  built-in interfaces to operating-system services make it ideal for writing portable, maintainable system-administration tools and utilities (sometimes called  shell tools). Python programs can search files and directory trees, launch other programs, do parallel processing with processes and threads, and so on. Python’s standard library comes with POSIX bindings and so on.

GUIs

Python’s simplicity and rapid turnaround also make it a good match for graphical user interface programming on the desktop. Python comes with a standard object-oriented interface to the Tk GUI API called  tkinter(Tkinterin 2.X) that allows Python programs to implement portable GUIs with a native look and feel. Python/tkinter GUIs run un-changed on Microsoft Windows, X Windows (on Unix and Linux), and the Mac OS (both Classic and OS X). A free extension package, PMW, adds advanced widgets to
the tkinter toolkit. In addition, the wxPythonGUI API, based on a C++ library, offers an alternative toolkit for constructing portable GUIs in Python.

Internet Scripting

Python comes with standard Internet modules that allow Python programs to perform a wide variety of networking tasks, in client and server modes. Scripts can communicate over sockets; extract form information sent to server-side CGI scripts; transfer files by FTP; parse and generate XML and JSON documents; send, receive, compose, and parse email; fetch web pages by URLs; parse the HTML of fetched web pages; communicate over XML-RPC, SOAP, and Telnet; and more. Python’s libraries make these tasks re-markably simple.

Who Uses Python Today?

Now a day Python is used by many well Known Companies For instance, among the generally known
Python user base:

*Googlemakes extensive use of Python in its web search systems.

• The popular YouTubevideo sharing service is largely written in Python.

• The Dropboxstorage service codes both its server and desktop client software pri-marily in Python.

• The Raspberry Pisingle-board computer promotes Python as its educational lan-guage.

• EVE Online, a massively multiplayer online game (MMOG) by CCP Games, uses
Python broadly.

• The widespread  BitTorrentpeer-to-peer file sharing system began its life as a
Python program.

• Industrial Light & Magic,  Pixar, and others use Python in the production of ani-mated movies.

• ESRIuses Python as an end-user customization tool for its popular GIS mapping
products.

• Google’s App Engineweb development framework uses Python as an application
language.

Is Python a “Scripting Language”?

Python is a general-purpose programming language that is often applied in scripting roles. It is commonly defined as an  object-oriented scripting language—a definition that blends support for OOP with an overall orientation toward scripting roles. If pressed for a one-liner, I’d say that Python is probably better known as
a general-purpose pro- gramming language that blends procedural, functional, and object-oriented paradigms—a statement that captures the richness and scope of today’s Python.

Still, the term “scripting” seems to have stuck to Python like glue, perhaps as a contrast with larger programming effort required by some other tools. For example, people often use the word “script” instead of “program” to describe a Python code file. In keeping with this tradition, this book uses the terms “script” and “program” interchangeably, with a slight preference for “script” to describe a simpler top-level file and “program” to refer to a more sophisticated multifile application.

Because the term “scripting language” has so many different meanings to different observers, though, some would prefer that it not be applied to Python at all. In fact, people tend to make three very different associations, some of which are more useful than others, when they hear Python labeled as such:

Shell tools

Sometimes when people hear Python described as a scripting language, they think it means that Python is a tool for coding operating-system-oriented scripts. Such programs are often launched from console command lines and perform tasks such as processing text files and launching other programs. Python programs can and do serve such roles, but this is just one of dozens of common Python application domains. It is not just a better shell-script language.

Control language

To others, scripting refers to a “glue” layer used to control and direct (i.e., script) other application components. Python programs are indeed often deployed in the context of larger applications. For instance, to test hardware devices, Python pro-grams may call out to components that give low-level access to a device. Similarly, programs may run bits of Python code at strategic points to support end-user
product customization without the need to ship and recompile the entire system’s

Why Do People Use Python?

The first question on your mind that why use python not other. Because there are many programming languages available today, this is the usual first question of newcomers. Given that there are roughly 1 million Python users out there at the moment, there really is no way to answer this question with complete accuracy;
the choice of development tools is sometimes based on unique constraints or personal preference.

But after teaching Python to roughly 260 groups and over 4,000 students during the
last 16 years, I have seen some common themes emerge. The primary factors cited by
Python users seem to be these:


Software quality

For many, Python’s focus on readability, coherence, and software quality in general
sets it apart from other tools in the scripting world. Python code is designed to be
readable, and hence reusable and maintainable—much more so than traditional
scripting languages. The uniformity of Python code makes it easy to understand,
even if you did not write it. In addition, Python has deep support for more advanced
software reusemechanisms, such as object-oriented (OO) and function program-ming.


Developer productivity

Python boosts developer productivity many times beyond compiled or statically
typed languages such as C, C++, and Java. Python code is typically  one-third to
one-fifththe size of equivalent C++ or Java code. That means there is less to type,
less to debug, and less to maintain after the fact. Python programs also run imme-diately, without the lengthy compile and link steps required by some other tools,
further boosting programmer speed.


Program portability

Most Python programs run unchanged on all major computer platforms. Porting
Python code between Linux and Windows, for example, is usually just a matter of
copying a script’s code between machines. Moreover, Python offers multiple op-tions for coding portable graphical user interfaces, database access programs, web-based systems, and more. Even operating system interfaces, including program launches and directory processing, are as portable in Python as they can possibly be.

Page(3)PREV 123