- Object Oriented Python Tutorial
- Environment Setup
- Data Structures
- Building Blocks
- Object Oriented Shortcuts
- Inheritance and Ploymorphism
- Python Design Pattern
- Advanced Features
- Files and Strings
- Exception and Exception Classes
- Object Serialization
- Python Libraries
- Object Oriented Python Resources
- Quick Guide
- Useful Resources
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Object Oriented Python - Environment Setup
This chapter will explain in detail about setting up the Python environment on your local computer.
Prerequisites and Toolkits
Before you proceed with learning further on Python, we suggest you to check whether the following prerequisites are met −
Latest version of Python is installed on your computer
An IDE or text editor is installed
You have basic familiarity to write and debug in Python, that is you can do the following in Python −
Able to write and run Python programs.
Debug programs and diagnose errors.
Work with basic data types.
Write for loops, while loops, and if statements
If you don’t have any programming language experience, you can find lots of beginner tutorials in Python onhttps://www.tutorialpoints.com/
The following steps show you in detail how to install Python on your local computer −
Step 1 − Go to the official Python website https://www.python.org/, click on the Downloads menu and choose the latest or any stable version of your choice.
Step 2 − Save the Python installer exe file that you’re downloading and once you have downloaded it, open it. Click on Run and choose Next option by default and finish the installation.
Step 3 − After you have installed, you should now see the Python menu as shown in the image below. Start the program by choosing IDLE (Python GUI).
This will start the Python shell. Type in simple commands to check the installation.
Choosing an IDE
An Integrated Development Environment is a text editor geared towards software development. You will have to install an IDE to control the flow of your programming and to group projects together when working on Python. Here are some of IDEs avaialable online. You can choose one at your convenience.
- Pycharm IDE
- Komodo IDE
- Eric Python IDE
Note − Eclipse IDE is mostly used in Java, however it has a Python plugin.
Pycharm, the cross-platform IDE is one of the most popular IDE currently available. It provides coding assistance and analysis with code completion, project and code navigation, integrated unit testing, version control integration, debugging and much more
Why to Choose?
PyCharm offers the following features and benefits for its users −
- Cross platform IDE compatible with Windows, Linux, and Mac OS
- Includes thousands of plugins, integrated terminal and version control
- Integrates with Git, SVN and Mercurial
- Offers intelligent editing tools for Python
- Easy integration with Virtualenv, Docker and Vagrant
- Simple navigation and search features
- Code analysis and refactoring
- Configurable injections
- Supports tons of Python libraries
- Includes Python/Django debuggers
- Works with Google App Engine, additional frameworks and libraries.
- Has customizable UI, VIM emulation available
It is a polyglot IDE which supports 100+ languages and basically for dynamic languages such as Python, PHP and Ruby. It is a commercial IDE available for 21 days free trial with full functionality. ActiveState is the software company managing the development of the Komodo IDE. It also offers a trimmed version of Komodo known as Komodo Edit for simple programming tasks.
This IDE contains all kinds of features from most basic to advanced level. If you are a student or a freelancer, then you can buy it almost half of the actual price. However, it’s completely free for teachers and professors from recognized institutions and universities.
It got all the features you need for web and mobile development, including support for all your languages and frameworks.
The download links for Komodo Edit(free version) and Komodo IDE(paid version) are as given here −
Komodo Edit (free)https://www.activestate.com/komodo-edit
Komodo IDE (paid)https://www.activestate.com/komodo-ide/downloads/ide
Why to Choose?
- Powerful IDE with support for Perl, PHP, Python, Ruby and many more.
- Cross-Platform IDE.
It includes basic features like integrated debugger support, auto complete, Document Object Model(DOM) viewer, code browser, interactive shells, breakpoint configuration, code profiling, integrated unit testing. In short, it is a professional IDE with a host of productivity-boosting features.
Eric Python IDE
It is an open-source IDE for Python and Ruby. Eric is a full featured editor and IDE, written in Python. It is based on the cross platform Qt GUI toolkit, integrating the highly flexible Scintilla editor control. The IDE is very much configurable and one can choose what to use and what not. You can download Eric IDE from below link:https://eric-ide.python-projects.org/eric-download.html
Why to Choose
- Great indentation, error highlighting.
- Code assistance
- Code completion
- Code cleanup with PyLint
- Quick search
- Integrated Python debugger.
Choosing a Text Editor
You may not always need an IDE. For tasks such as learning to code with Python or Arduino, or when working on a quick script in shell script to help you automate some tasks a simple and light weight code-centric text editor will do. Also many text editors offer features such as syntax highlighting and in-program script execution, similar to IDEs. Some of the text editors are given here −
- Sublime Text
Atom Text Editor
Atom is a hackable text editor built by the team of GitHub. It is a free and open source text and code editor which means that all the code is available for you to read, modify for your own use and even contribute improvements. It is a cross-platform text editor compatible for macOS, Linux, and Microsoft Windows with support for plug-ins written in Node.js and embedded Git Control.
Sublime Text Editor
Sublime text is a proprietary software and it offers you a free trial version to test it before you purchase it. According to stackoverflow.com, it’s the fourth most popular Development Environment.
Some of the advantages it provides is its incredible speed, ease of use and community support. It also supports many programming languages and mark-up languages, and functions can be added by users with plugins, typically community-built and maintained under free-software licenses.
Why to Choose?
Customize key bindings, menus, snippets, macros, completions and more.
Auto completion feature
- Quickly Insert Text & code with sublime text snippets using snippets, field markers and place holders
Cross Platform support for Mac, Linux and Windows.
Jump the cursor to where you want to go
Select Multiple Lines, Words and Columns
It’s a free source code editor and Notepad replacement that supports several languages from Assembly to XML and including Python. Running in the MS windows environment, its use is governed by GPL license. In addition to syntax highlighting, Notepad++ has some features that are particularly useful to coders.
- Syntax highlighting and syntax folding
- PCRE (Perl Compatible Regular Expression) Search/Replace
- Entirely customizable GUI
- SAuto completion
- Tabbed editing
- Multi-Language environment
- Launchable with different arguments
- Almost every language (60+ languages) like Python, C, C++, C#, Java etc.