Skip to main content

Learning Python - Part-5: Python Interfaces

When it comes to working with python, we can always use interactive mode by launching python or Python3 command as shown in below screenshot. 

Image: 1
Once launched we can run all sorts of python operations, however, this approach is not used for development work. 

When it comes to writing programs, we generally prefer editors. In fact we can use basic editors like notepad(Windows)/vi editors(Linux). In these editors, once we are done with writing programs, we need to make sure files are stored as .py extension (Image: 2). We simply run python command to execute the programs as shown in below screenshot (Image: 3).


Image: 2

Image: 3
Though using normal editors is fine, but when it comes to writing simple, large or complex programs, these basic editors do not offer help or suggestions or correction while writing code. That is where the need of tools that help during programming arises. Below are some of the code editors and IDEs that are widely used.

Code Editors:

A code editor is a tool that is used to write and edit code. They are usually lightweight and can be great for learning.
  • Sublime Text 3:
    • License: Freemium
    • Users: Beginners, Pros
    • Download link: Sublime


Sublime Text is one of the popular code editor. It does supports multiple programming languages. Python is included as inbuilt support so additional steps are not required. Sublime text is fast and highly customisable editor. It has a huge community.

You can install packages such as debugging, auto-completion, code linting, etc. There are also packages for scientific development, Django, Flask and so on. You can customise Sublime text to create a full-fledged Python development environment.

  • Atom:
    • License: Free
    • Users: Beginner, Professional 
    • Download Link; Atom

Atom is an open-source code editor (by Github) which can be used for Python development.

Atom is highly customisable. You can install packages as per requirements. Commonly used packages for Python development are autocomplete-python, linter-flake8, python-debugger and others.

  • Visual Studio Code:
    • License: Free
    • Users: Professionals
    • Download Link: VS Code

Visual Studio Code (AKA VS Code) is a free and open-source IDE developed by Microsoft.

You can add extensions to create a Python development environment as per requirement in VS code. It provides features such as intelligent code completion, linting for potential errors, debugging, unit testing and so on.

VS Code is lightweight and packed with powerful features. VS Code is a popular editor among Python developers.

IDEs:

An IDE (Integrated Development Environment) understands code much better than a text editor. It provides features like build automation, linting, testing and debugging. This significantly speeds up development tasks. The downside is that IDEs are:
  • Large size
  • Resource intensive
  • Complex to use initially
  • License may be required for certain feature

  • IDLE: 
    • License: Free 
    • Users: Beginners

When we install Python, IDLE is also installed by default. This makes it easy to get started with Python. 


IDLE has features like:
  • Python shell window(interactive interpreter) 
  • auto-completion 
  • syntax highlighting
  • smart indentation
  • basic integrated debugger.
IDLE is lightweight and simple to use. However, may not that helpful for larger or complex projects.


  • Thonny:
    • License: Freemium
    • Users: Beginners
    • Download Link: Thonny


Thonny is a Python dedicated IDE. It has Python 3 built-in, so we can start writing Python codes once we install Thonny.

Thonny is intended for beginners and the user interface is designed to be simple so it is easy to get started.

Though Thonny is for beginners, it has several features that also make it a good IDE for full-fledged Python development. 

Features:
  • error highlighting
  • debugger
  • code completion
  • step through expression evaluation

  • PyCharm:
    • License: Freemium
    • Users: Professional
    • Download link: PyCharm

PyCharm is an IDE for professional developers. It is designed and developed by JetBrains.

There are two versions of PyCharm:
  • Community - 
    • free open-source version, lightweight, good for Python and scientific development
  • Professional - 
    • paid version, full-featured IDE with support for Web development as well
PyCharm provides all major features that a IDE should provide: 
  • code completion
  • code inspections
  • error-highlighting and fixes
  • debugging
  • version control system
  • code refactoring. 
  • All these features come out of the box.
However, PyCharm can be resource-intensive and may slow down system performance in case your system does not have enough resources.

  • Spyder:
    • License: Free
    • Users: Beginners, Professional
    • Download Link: Anaconda

Spyder is an open-source IDE mostly used for scientific development.

The easiest way to get up and running up with Spyder is by installing Anaconda distribution which is a popular distribution for data science and machine learning.

Spyder has some great features such as autocompletion, debugging and iPython shell. However, it lacks in features compared to PyCharm.

  • Jupyter Notebook:
    • License: Free
    • Users: Professionals
    • Download Link: Anaconda

The Jupyter Notebook is an open source web application that we can use to create and share documents that contain live code, equations, visualizations, and text. Jupyter Notebook is maintained by Project Jupyter. 

The most popular distribution of Python is Anaconda. We can also use terminal to install Jupyter as shown below.



The name, Jupyter, comes from the core supported programming languages that it supports: Julia, Python, and R. 

Jupyter is shipped with the IPython kernel, which allows you to write your programs in Python, however, currently over 100 other kernels are supported that we can use.

Comments

Popular posts from this blog

Learning Python Part-6: Python Comments

When it comes to writing a python program, based on the requirements, programs can simple programs of limited number of  lines or it can be really large program which might even span multiple python modules. Now the point here is that, even if we know how to write the program and even we follow correct concepts and syntaxes while writing program, we cannot keep it in our mind forever. We cannot remember each and everything about the program like variables, classes, concepts, functions and so on after some period of time. If the program written by us at some point in time back, once we open it after a period of time, it should not be a situation that we are blank, or guessing why particular code, function and so on. Even it may happen that you are working in a team and program code writing tasks might be shared. So when you put all pieces together written by multiple programmers in your team, you should be able to understand the code. This is where we bring in the concepts of

Learning Python Part-4: Python Keywords

Python has a set of keywords that are reserved words that cannot be used as variable names, function names, or any other identifiers They are used to define the syntax and structure of the Python language. In Python, keywords are case sensitive. There are 33 keywords in Python 3.7.  All the keywords (except True, False and None) are in lowercase. Below is the list of keywords in Python 3.7 I will not be using just syntax to explain these keywords, rather I will use some simple yet enough code examples considering new plus experienced people. For those who are new to python, if you find it difficult  to understand the complete code, just try to see the context and usage of keyword.  False :  This keyword is used to represent a boolean false. If a statement is false, “False” is printed. False in python equals to 0. True: This keyword is used to represent a boolean true. If a statement is true, “True” is printed. True in python equals to 1. None:

Welcome

Welcome everyone to CodeZen. Learn to code with simplified tutorials and examples.  Our focus will always be on simplicity. Hence all programming tutorials and examples are written in simple, understandable language for everyone including beginners.  The only way to learn to program is by writing code. So we encourage you to try the example we provided, implement your imagination and take it to next level.  We know that there are thousands of resources available on these topics. We just want make difference in how the information is presented so that everyone can understand. We simply want to present a different approach of detailed yet simple, with other - more interesting - examples, and so on.