Tuesday 31 January 2017

Benefits of Python

Benefits of Python

Python is a dynamic object-oriented programming language that would be compared with Java and Microsoft's .NET-based languages as a general-purpose substrate for many kinds of software development. It offers strong support for integrating with other technologies, higher programmer productivity throughout the development life cycle, and is particularly well suited for large or complex projects with changing requirements.

Python is the most rapidly growing open source programming language. According to InfoWorld its user base is nearly doubled in 2004, and currently includes 14% of all programmers.

Python is being used in mission critical applications in the world's largest stock exchange, forms the basis for high end
newspaper websites, run on millions of cell phones, used in industries as diverse as ship building, feature length movie animation, and air traffic control.

Python is available for most operating systems, including Windows, UNIX, Linux, and Mac OS.

Key Strengths
Python's clean object-oriented design which would extensively support libraries and offer two to ten fold. The programmer productivity seen with languages like C, C++, C#, Java, VB, and Perl.

Python's key strengths
Integration
Of all types, including Enterprise Application Integration (EAI). Python makes it easy to develop Web services, which would invoke COM or CORBA components, calls directly to and from C, C++, or Java code (via Jython), provides powerful process control capabilities, implements all common internet protocols and data formats, processes XML and other markup languages, that would be embedded as a scripting language, and runs from the same byte code on all modern operating systems.

Network intensive applications
Complex multi-protocol network applications that would build a Twisted, a development framework well suited for running large number of concurrent network, database, and inter-process communication links within the same process.

Web development
From simple CGI scripting to high-end web application development with mega-frameworks such as Django and TurboGears, the Zope application server, Plone content management system, Quixote web application framework, or even a home-grown solution based on Python's extensive that is easy to use standard libraries. Python provides interfaces to most databases, powerful text processing and document processing facilities, and plays well with other web technologies.

Numeric and scientific applications
Use of the Python Imaging Library, VTK and MayaVi 3D Visualization Toolkits, Numeric Python, Scientific Python and many other tools available for numeric and scientific applications. Many of these are supported by the Enthought Python Distribution.

Application scripting
Snap with Python's tight integration with C/C++ and Java. Python was designed from the ground up to be embeddable and serves as an excellent choice as a scripting language for customization or extension of larger applications.

Software Testing
Benefits from Python’s strong integration and text processing capabilities, and Python come with its own unit testing framework.

Desktop development
Using wxPython, PyQt, or PyGtk for high-quality GUI applications. Protect the investment by basing on open technologies, with deployment to most operating systems. Support for other GUI frameworks, such as MFC, Carbon, Delphi, X11, Motif, and Tk, is also available.

Prototyping
Python is quick and easy, and often results in development of the final system. The agile nature of the language and the ease of refactoring code make for rapid development directly from the initial prototype.

The Open Source Advantage
It would be developed as open source by thousands of contributors from around the world; Python is very well designed, fast, robust, portable, and scalable. With an uncluttered, easy-to-learn syntax and well-developed advanced language features, Python often exceeds the capabilities of comparable commercially available solutions.

The open source license for Python allows unrestricted use, modification, and redistribution of the language or anything that is based on it, commercially or otherwise. Full source is available and there are no license costs. Support is available for free, from a rich set of internet-based resources, and from organizations in the business of providing paid support to Python users.


Saturday 28 January 2017

Utilization of Python Programming

Utilization of Python Programming


Python in Linux admin
 Python is a must learn programming language for Linux admin. Almost more than 20 percent of Linux job require Python programming and also Software developers have a great asset to mention on their CV.

Python in Automation testing professionals
For software testing professional Python skills are must which is required to write test cases and run to check software performance, build test automation framework and also requirement for mobile and device testing professionals.

Python in Database programming
Used in developing Database and rectifies the error, add efficiency to work and improves the productivity of Database developers.

Python in Develop Complex website and systems
It has an own frameworks, Django which is MVC based framework used in developing complex and large websites specially used to develop social networking sites. Most popular Social sites like Facebook and question answer website Quora has been developed using Python programming language. As a Python programmer are getting paid more compared to other language programmers. There was a huge community built around python. Python programming is one of the most taught programming languages in US which is easy to learn and more efficient in solving complex problems.

Major Internet and mobile companies like Yahoo, Google, Facebook, Nokia, NASA and many others major market players use Python programming to develop easy to use simplified web application and systems. Along with these Python is also core to Linux must for all Linux programmer and system developer.
Python is an open source programming language and used to develop simple to complex functions. Python programming is used to develop websites, develop database systems, Device and software testing and also used to develop system programming.
 WHY PYTHON PROGRAMMING LANGUAGE HAS A BRIGHT FUTURE?
Python has been voted as most favorite programming language beating C, C++ and java programming. Python programming is open source programming language and used to develop all kind of application.

Python is being used as worldwide in a wide range of application development and system development programming language. Big brands and search engine giants are using python programming to make their task easier. Google, Yahoo, Quora, Facebook are using python programming to solve their complex programming problems.

Python programming is versatile, robust and comprehensive. Python is high level programming language and easy to learn as well as it reduces the coding effort compare to other programming languages.

Python programming is used to write test scripts and test mobile devices performance. In these days, python is one of the most versatile languages. Nowadays Python programmers are most demandable in IT industry and get paid more compare to other language programmer.

Python programming language helps solve complex problem quickly and integrate with system more effectively. Python is involved in lots of environment such as system development, networking, database development, Device and automation testing and many more and its skill is must as a programmer to grow in career. Thus feature of Python programming language is bright and secured.


Friday 27 January 2017

Python Keywords and Identifiers

Keywords in Python

Keywords in python are the reserved words that cannot be used as variable name or function name or ordinary identifiers; they must be spelled exactly as they are written.

Explanation of Keywords

print – Used to print to console.

while – Used for controlling the flow of the program.

for – Used to iterate over times of a collection in order that they present.

break – Used to interrupt the loop or cycle when they are needed.

continue – Used to interrupt the current cycle without jumping out of the whole cycle.

if – Used to determine which statements are to be executed.

elif – This stands for else if. In this the first test evaluates to false then it continues with the next one.

else – It is an optional one, the else keyword is executed, unless the condition is true.

is – Used for testing the object identity.

not – This is used to negates the Boolean value.

and -  By using this all conditions in the Boolean expressions are met.

or – By using this atleast one condition must meet.

import – With this import the other python modules into a python script.

as – By using this give module in different alias.

from -  Used for importing a specific variable, class or a function from a module.

def – Used for creating an new user defined function.

return – Used for exits the function and returns a value.

lambda – Used to create a new anonymous function.

global – Used to define the outside functions and access the variables.

try – With the help of this find the exception handlers.

expect – Used for executing the code and then catches the exception.

finally – With this clean up resources and its always executed at the end.

raise – Used to create an user defined exception.

del – Used to delete objects.

pass – It does nothing.

assert – Its used for the debugging process.

class – This is used for creating the new user defined objects. 

exec – Used for executing the python code dynamically.

yield – This is used along with the generators.  

Python Identifiers

Identifier is the name given to the entities like class, functions, variables etc. which helps differentiating one entity from another.

Rules for Writing Identifiers

1) Identifiers is a combination of letters in lowercase (a to z) or uppercase (A to Z) or digits (0 to 9) or an underscore (_). Names like myClass, var_1 and print_this_to_screen, are valid examples.

2)An identifier cannot start with a digit.1variable is invalid, but variable is perfectly fine.

3)Keywords cannot be used as identifiers.

>>>global = 1
File “<interactive input>”, line 1
global = 1
^

Syntax Error: invalid syntax

4)Does not use special symbols like !, @, #, $, % etc. in our identifier.

>>> a@ = $
File “<interactive input>”, line 1
a@ = $
^

Syntax Error: invalid syntax

5)Identifier can be of any length.


Wednesday 25 January 2017

Python For Beginners

Python For Beginners

Welcome! Are you completely new to programming? If not then we presume you will be looking for information about why and how to get started with Python. Fortunately an experienced programmer in any programming language would pick up Python very quickly. It's easy for beginners to use and learn, so jump in!
Installing
Installing Python is generally easy, and nowadays many Linux and UNIX distributions include a recent Python. Even some Windows computers come with Python already installed. If you need to install Python and aren't confident about the task you can find a few notes but installation is unremarkable on most platforms.
Learning
Before getting started, you may want to find out which IDEs and text editors are tailored to make Python editing easy, browse the list of introductory books, or look at code samples that might helpful.
There is a list of tutorials suitable for experienced programmers. There is also a list of resources in other languages which might be useful.
The online documentation is the first port of call for definitive information. There is a fairly brief tutorial that gives the basic information about the language and gets started. Follow this by looking at the library reference for a full description of Python libraries and the language reference for a complete explanation of Python's syntax. If you are looking for common Python recipes and patterns, browse the Active State Python Cookbook.
Looking for Something Specific?
If you want to know whether a particular application, or a library with particular functionality, is available in Python there are a number of possible sources of information. The Python web site provides a Python Package Index (also known as the Cheese Shop, a reference to the Monty Python script of that name). There is also a search page for a number of sources of Python-related information. Failing that, just Google for a phrase including the word ''python'' and get the result. If all fails, ask on the python newsgroup is a good chance someone will put you on the right track.


Tuesday 24 January 2017

Benefits of Python over Other Programming Language
Python
Python is an interpreted, interactive, high level programming language similar to PERL that has gained the popularity because of its clear syntax and readability which is easy to learn and portable.

Benefits of Python
Presence of Third Party Modules
The Python Package Index (PyPI) contains numerous third-party modules which make Python capable of interacting with most of the other languages and platforms.
Extensive Support Libraries
Python provides a large standard library that includes areas like internet protocols, string operations, web services tools and operating system interfaces. Many high use programming tasks have already been scripted into the standard library that reduces length of code to be written significantly.
Open Source and Community Development
Python language is developed under an OSI-approved open source license, which makes it free to use and distribute, including for commercial purposes.
Its development is driven by the community which collaborates its code through hosting conferences and mailing lists, and provides for its numerous modules.
Learning Ease and Support Available
 Python offers excellent readability and uncluttered simple-to-learn syntax which helps the beginners to utilize this programming language. The code style guidelines, PEP 8, provide a set of rules to facilitate the formatting of code. Mostly the users and active developers resulted in a rich internet resource bank to encourage development and the continued adoption of the language.
User-friendly Data Structures
Python has built-in list and dictionary data structures which is used to construct fast runtime data structures and provides the option of dynamic high-level data typing which reduces the length of support code.
Productivity and Speed
Python has clean object-oriented design, provides enhanced process control capabilities, strong integration, text processing capabilities and its own unit testing framework which contribute to the increase in its speed and productivity which is considered a viable option for building complex multi-protocol network applications.

Applications of Python

GUI based desktop applications.
Ø Image processing and graphic design applications.
Ø Scientific and computational applications.
Ø Games.
Web frameworks and web applications
Enterprise and business applications
Operating systems
Language development
Prototyping


Saturday 21 January 2017

Python Multithreaded Programming

Python Multithreaded Programming

Running several threads is similar to running several different programs concurrently with the following benefits −
·        Multiple threads within a process share the same data space with the main thread and can share information or communicate with each other more easily than if they were separate processes.
·        Threads sometimes called light-weight processes and they do not require much memory overhead; they are cheaper than processes.
A thread has a beginning, an execution sequence, and a conclusion. It has an instruction pointer that keeps track of where its context it is currently running.
·        It can be pre-empted (interrupted)
·        It can temporarily on hold while other threads are running is called yielding.
Starting a New Thread
To spawn another thread, need to call the method available in thread module:
thread.start_new_thread ( function, args[, kwargs] )
This method call enables a fast and efficient way to create new threads in both Linux and Windows.
It is very effective for low-level threading, but the thread module is very limited compared to the newer threading module.
The Threading Module
The newer threading module included with Python 2.4 provides much more powerful, high-level support for threads.
It exposes all the methods of the thread module and provides some additional methods
·        threading.activeCount(): Returns the number of thread objects that are active.
·        threading.currentThread(): Returns the number of thread objects in the caller's thread control.
·        threading.enumerate(): Returns a list of all thread objects that are currently active.
In addition to the methods, the threading module has the Thread class that implements threading. The methods provided by the Thread class are as follows:
·        run(): The run() method is the entry point for a thread.
·        start(): The start() method starts a thread by calling the run method.
·        join([time]): The join() waits for threads to terminate.
·        isAlive(): The isAlive() method checks whether a thread is still executing.
·        getName(): The getName() method returns the name of a thread.
·        setName(): The setName() method sets the name of a thread.
Creating Thread Using Threading Module
To implement a new thread using the threading module to do the following −
·        Define a new subclass of the Thread class.
·        Override the __init__(self [,args]) method to add additional arguments.
·        Then, override the run(self [,args]) method to implement what the thread should do when started.
Synchronizing Threads
The threading module provided with Python includes a simple-to-implement locking mechanism that allows to synchronize threads. A new lock is created by calling the Lock() method, which returns the new lock.
acquire(blocking) - Used to force threads to run synchronously enables to control whether the thread waits to acquire the lock.
release() - Used to release the lock when it is no longer required.
Multithreaded Priority Queue
The Queue module allows to create a new queue object that can hold a specific number of items. There are following methods to control the Queue −
·        get(): The get() removes and returns an item from the queue.
·        put(): The put adds item to a queue.
·        qsize() : The qsize() returns the number of items that are currently in the queue.
·        empty(): The empty( ) returns True if queue is empty; otherwise, False.
·        full(): the full() returns True if queue is full; otherwise, False. 

Thursday 19 January 2017

Python Identifiers


Python Identifiers
A Python identifier is a name used to identify a variable, function, class, module or other object. An identifier starts with a letter A to Z or a to z or an underscore (_) followed by zero or more letters, underscores and digits (0 to 9).
The python does not allow punctuation characters such as @, $, and % within identifiers. Python is a case sensitive programming language. Thus, Manpower and manpower are two different identifiers in Python.
Naming Conventions for Python Identifiers
Class names start with an uppercase letter. All other identifiers start with a lowercase letter.
Starting an identifier with a single leading underscore indicates that the identifier is private.
Starting an identifier with two leading underscores indicates a strongly private identifier.
If the identifier also ends with two trailing underscores, the identifier is a language-defined special name.


Wednesday 18 January 2017

General Information about Python


What is Python?

Python is a deciphered, intuitive, protest arranged programming dialect. It fuses modules, exemptions, dynamic writing, abnormal state dynamic information sorts, and classes and consolidates exceptional power with clear language structure. It has interfaces to numerous framework calls, libraries, and in addition to different window frameworks, and is extensible in C or C++. It is an expansion language for applications that need a programmable interface. It is portable and running on numerous UNIX variations, on the Mac, and on PCs under MS-DOS, Windows, Windows NT, and OS/2.

Why it is called Python?

When began implementing Python, Guido van Rossum reading the published scripts from “Monty Python’s Flying Circus”, a BBC comedy series from the 1970s. He thought that he needed a name that was short, unique, and slightly mysterious, so he decided to call the language Python.

Why Python created in first place?

Implementing an interpreted language in the ABC group at CWI has a lot about language design. This is the origin of many Python features, including the use of indentation for statement grouping and the inclusion of very-high-level data types (although the details are all different in Python).

Modula-3 is the origin of the syntax and semantics used for exceptions, and some other Python features.

A better way is needed to do system administration by writing either C programs or Bourne shell scripts, since Amoeba had its own system call interface which wasn’t easily accessible from the Bourne shell.

A scripting language with syntax like ABC but access to the Amoeba system calls would fill the need to write an Amoeba-specific language that was generally extensible.

Python was used in the Amoeba project with increasing success, and the feedback made many early improvements. In February 1991, it is posted to USENET.

What Python is good for?

Python is a high-level general-purpose programming language that can be applied to many different classes of problems comes with a large standard library which covers areas such as string processing, Internet protocols (HTTP, FTP, SMTP, XML-RPC, POP, IMAP, CGI programming), software engineering (unit testing, logging, profiling, parsing Python code), and operating system interfaces (system calls, file systems, TCP/IP sockets). A wide variety of third-party extensions are also available.