Which Code Editors Do Pythonists Use?

Share this article

Not into Python? Prefer Ruby instead? Here are the most popular editors and IDEs for Rubyists.

So, you’ve decided to learn Python? Great! Python is a really interesting programming language, that has been described as a descendent of ABC that appeals to Unix/C developers. And you can’t go wrong with a language named after Monty Python!

So yes, you have many exciting things waiting for you.

But one of the first things you’ll need to do is pick an editor you’ll use to write your Python program. Well, here comes the confusion. You’re faced with tons of editors out there, each with a community trying to get you attracted to using that editor. “Use vim!” “Use Emacs!” “Use Sublime Text!”

You recoil in fear… what if you make the wrong choice?

This feeling inspired me to interview Pythonists about their favorite Python editor. This will show which editors are used by the most Pythonists, and from there we can try to work out why. My hope is that it’ll serve as a guide for newcomers to Python, or even for those already working with Python.

I’ll start by discussing the most popular editors, then take a look at the advantages (and disadvantages) of the winner, before moving on to looking at how to install it onto your system.

The Survey

I spoke to 100 Pythonists, who brought up the following editors (presented here in order of popularity):

  1. Sublime Text
  2. Vim
  3. Emacs
  4. Notepad++
  5. TextWrangler
  6. IDLE
  7. Atom
  8. Aquamacs
  9. GNU Nano
  10. Kate
  11. gedit

Sublime Text was by far the most preferred editor, used by 45% of the interviewees. The charts below tell the tale:

Fig.1 Fig.2

From the figures above, we can see Sublime Text rules as the favorite Python editor from the sample I have interviewed. This seems to go hand in hand with Sublime Text’s slogan: The text editor you’ll fall in love with.

Sublime Text’s Advantages

So what makes Sublime Text so special?

Like others, I use Sublime for my Python work. I like the features mentioned in this post about Sublime Text. Briefly, these are:

  • Packages: Sublime Text comes with a fully-featured package manager that helps the programmer to discover, install, update, and remove packages for Sublime Text.

  • Macros: Instead of retyping simple strings of text, you can simply record macros and create a keyboard shortcut to output that text into your document.

  • Colors: In Sublime Text, you can quickly pick colors for the interface and text.

Other useful features for Sublime Text, as mentioned in this SitePoint Smackdown post, are as follows:

  • Comprehensive language support with TextMate-compatible grammar

  • “Goto Anything” quick navigation to locate files and code

  • A command palette to access all features

  • Extensive customization, great themes and numerous plugins

Sublime Text’s Shortcomings

However, Sublime Text still needs some improvements to become a better editor for Python.

Here are some ways Sublime Text could be improved to work better with Python:

  • In Sublime Text, some deep language specific integration features such as static analysis and refactoring, also available through plugins, are not that polished.

  • Dynamic analysis of code and autocomplete need to be enhanced.

  • Sublime Text could be made more friendly to new Python programmers. For example, if one needs to configure the application’s preferences, this is done by writing/editing lines of code. This is something a new programmer may feel uncomfortable attempting.

  • As a continuation to the previous point, Sublime Text needs to be simplified a bit, as it has a steep learning curve, and plugins need to be simplified, since they can be confusing.

  • While the app can be equipped with impressive features, these have to be installed separately, and some of them are not free.

  • Sublime Text is inaccessible via the terminal.

How to Set Up Sublime Text for Python

So, you want to give it a try? In this section, I’ll show you how to setup Sublime Text to work with Python. I will be demonstrating this on a Microsoft Windows 8.1 machine. If you want to do that on a MAC OS X machine, you can follow this tutorial, and on an Ubuntu machine, you can refer to this thread.

Let’s get started.

Installing Python

Download Python from here. I will download Python 3.4.2. This will be an msi file. Thus, the file you will get downloaded is python-3.4.2.msi. Run the installer, for which it will display the wizard shown in the figure below:

pythonInstaller

Navigate through the steps until you finish the setup wizard. You’ll notice that Python was installed in C:\Python34\, if you kept the default location.

Installing Cygwin

The next step is to setup Cygwin, a tool for providing Windows with similar functionality to a Linux distribution. If you’re on a 32-bit Windows, download the setup file from here. If you are on a 64-bit Windows, download the setup file from here. After you download the appropriate setup file, run that file, for which you will get the following start page in the wizard:

cygwinInstaller

Keep navigating through the installer until you reach the following step:

cygwinInstaller-2

In this step, we’ll be installing three software packages: curl, git, and openssh. For this, let’s use the Search box. For example, for curl, type the word in the search box, but, be careful, don’t hit the enter key, as this will continue the Cygwin installation. When you type curl in the search box, you should get something like the following:

cygwinInstaller-3

What we want to do now is install each of the packages above. Click on the + sign. You will notice skip, click on skip, so you get the latest version number of the package, which we want to install. In this case, you should get something similar to the following:

cygwinInstaller-4

Click the Next button, and wait until the packages are downloaded. This might take some time to finish.

Do the same for the other two packages, git and openssh.

After you finish, you should get a Cygwin shortcut at your desktop, like this:

cygwinIcon

Through this terminal, you’ll be running your Python code, in addition to accessing the packages installed above. If you double click the icon shortcut, you should get something like the below image:

bash

To make sure that the packages were installed, and get an idea of their locations, we will use the
which command, as follows:

confirm

I was able to install Python through Cygwin using the following step (notice ‘Python’ at the end):

python

If you happen to miss this step, or you want Cygwin to find and use the Python version you installed above, you can issue this command in the terminal:

$ echo "PATH=\$PATH:/cygdrive/c/Python34" >> .bash_profile

Installing Sublime Text

Now, for the easiest part. To install Sublime Text, go to the Sublime Text homepage, download, and set it up. Very easy!

Test Your Installation

At this point of the tutorial, let’s test if our setup works, and we’re ready to use Sublime Text to work with Python.

Open Sublime Text, and type this line of code:

print("Hello Python!)

Choose File -> Save. In the Save As dialog box, choose where to save the file, name the file, and in Save as type:, choose Python. For instance, this is what I chose:

saveAs

Now, open the terminal (Cygwin icon shortcut), and navigate to where you saved your Python file. In my case, it was on the Desktop. In my case, the file path would like like the following:

filePath

Finally, type the following command in the terminal to run the Python program:

python hello

In which case, you should get the following output:

output

You now have everything setup, and ready to delve through the Python world with Sublime Text! One of the first things you should do now is check out this collection of plugins for Python development with Sublime Text.

Conclusion

While Sublime Text has a commanding lead in numbers, that’s but one consideration. There are many popular editors, and it may not be right for every Pythonist. Nevertheless, it’s always good to know how the majority handle their projects, and there is something to be said for using a popular app or technology.

What is your favorite Python editor? How do you set it up for working productively?

Frequently Asked Questions (FAQs) about Python Code Editors

What are the key features to look for in a Python code editor?

When choosing a Python code editor, there are several key features to consider. Firstly, the editor should have syntax highlighting for Python, which makes the code easier to read and understand. Secondly, it should have code completion, which suggests possible completions for your typing and saves you time. Thirdly, it should have a built-in Python debugger, which allows you to test your code and find errors. Other useful features include code navigation, which helps you navigate through your code, and refactoring tools, which help you restructure your code without changing its behavior.

Why is Sublime Text a popular choice for Python developers?

Sublime Text is a popular choice for Python developers due to its speed, efficiency, and powerful features. It has a clean and uncluttered interface, which makes it easy to use. It also supports multiple programming languages, not just Python. Sublime Text has a robust package ecosystem, which allows you to add additional functionality to the editor. It also has a “Goto Anything” feature, which allows you to quickly navigate to files, symbols, or lines.

How does Visual Studio Code benefit Python programming?

Visual Studio Code (VS Code) is a free, open-source code editor that is highly customizable and extensible. It has built-in support for Python, including features like IntelliSense (code completions), linting (for potential errors), debugging, code navigation, code formatting, Jupyter notebook support, refactoring, and more. VS Code also has a large community and a marketplace with thousands of extensions, which can add additional features and functionality to the editor.

What makes PyCharm a suitable Python IDE for professional developers?

PyCharm is a professional Python IDE with a full set of tools for productive Python development. It includes features like intelligent code completion, on-the-fly error checking, quick-fixes, automated code refactoring, and navigation capabilities. PyCharm also integrates with popular Python libraries and frameworks, and supports web development with Django. It also has built-in tools for database management, version control, virtual environments, and more.

How does Atom compare with other Python code editors?

Atom is a free and open-source code editor that is highly customizable and extensible. It has built-in support for Python and includes features like syntax highlighting, auto-completion, and code navigation. Atom also has a package manager for installing additional packages, and a community of developers who contribute packages and themes. However, compared to other editors like Sublime Text or VS Code, Atom is known to be a bit slower and more resource-intensive.

Can I use Jupyter Notebook for Python coding?

Yes, Jupyter Notebook is a popular tool among data scientists and researchers for Python coding. It allows you to create and share documents that contain live code, equations, visualizations, and narrative text. Jupyter Notebook supports over 40 programming languages, including Python. It’s particularly good for data cleaning and transformation, numerical simulation, statistical modeling, data visualization, machine learning, and much more.

What are the advantages of using Spyder for Python development?

Spyder is a powerful Python IDE with features like advanced editing, interactive testing, debugging, and introspection. It’s particularly well-suited for scientific Python development, as it has integrated support for essential scientific libraries like NumPy, SciPy, and Matplotlib. Spyder also includes a multi-language editor with function/class browser, code analysis tools, and a Python console for interactive execution.

How does IDLE fit into the Python code editor landscape?

IDLE (Integrated Development and Learning Environment) is a default editor that comes with Python. It’s a simple editor with basic features like syntax highlighting, auto-completion, and a built-in Python shell. IDLE is a good choice for beginners who are just starting to learn Python, but professional developers might prefer more feature-rich editors like PyCharm or VS Code.

Can I use Notepad++ for Python coding?

Yes, Notepad++ is a free and lightweight code editor that supports Python and many other programming languages. It has features like syntax highlighting, code folding, auto-completion, and a function list. Notepad++ also supports plugins to add extra functionality. However, it lacks advanced features like integrated debugging or code navigation, which are available in more dedicated Python editors.

What is the role of a linter in a Python code editor?

A linter is a tool that analyzes source code to flag programming errors, bugs, stylistic errors, and suspicious constructs. In a Python code editor, a linter can help you write cleaner and more error-free code. It can check your code for potential errors and provide suggestions for improvements. Some editors, like PyCharm or VS Code, have built-in linting support, while others allow you to install linter as an extension or plugin.

Abder-Rahman AliAbder-Rahman Ali
View Author

Doctor and author focussed on leveraging machine/deep learning and image processing in medical image analysis.

code editorcode editorsIDEpython
Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week