Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set the default subtitles language in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

How to Improve Your Workflow

For more information on concepts covered in this lesson, you can check out:

00:00 How to Improve your Workflow.

00:04 Now that you’ve seen how to write, edit, and execute Python files in IDLE, it’s time to speed up your workflow. The IDLE editor offers a few features that you’ll see in most professional IDEs to help you code faster.

00:17 These features include automatic indentation, code completion, call tips, and code context. IDLE will automatically indent your code when it needs to start a new block.

00:31 This usually happens after you type a colon (:). When you hit the Enter key after the colon, your cursor will automatically move over a certain number of spaces and begin a new code block.

00:42 You can configure how many spaces the cursor will move in the settings, but the default is the standard four spaces.

00:52 The developers of Python agreed on a standard style for well-written Python code, and this includes rules on indentation, whitespace, and more. This standard style was formalized and is now known as PEP 8.

01:07 To learn more about it, check out How to Write Beautiful Python Code With PEP 8.

01:14 Wriiting code can be a complex process. There’s a lot to remember, and getting help when you need it can be the difference between getting your code working quickly or having a frustrating time. IDLE can help in two main ways here.

01:28 Firstly, call tips. A call tip is like a hint for a certain part of your code to help you remember what that element needs. After you type the left parentheses to bring in a function call, a call tip will appear if you don’t type anything for a few seconds. Here, The call tip for print shows the not-so-obvious parameters that you can add to a print function. If you want to clear this text, press Esc, and it will disappear.

01:55 The other area where IDLE can help is code completion. One particularly useful area is finding functions within modules. For instance, here the math module has been imported, and pressing Tab or waiting for a second or so shows the available functions. If you’ve already typed some letters, pressing Tab will take the pop-up to an entry that matches those letters.

02:17 You can use Tab to complete the selection or scroll using the cursor keys or mouse if you want to.

02:26 The code context functionality is a neat feature of the Python IDLE file editor. It will show you the scope of a function, class, loop, or other construct.

02:36 This is particularly useful when you’re scrolling through a lengthy file and need to keep track of where you are while reviewing code in the editor. To turn it on, select OptionsShow Code Context in the menu bar.

02:49 You’ll see a gray bar appear at the top of the editor window. On-screen, you can see part of the standard library being viewed. As the code is scrolled through, the context is retained in the gray bars at the top, sometimes to multiple levels deep.

03:05 This makes it much easier to understand this complex code as the context is being retained on-screen rather than being something you have to keep in memory.

03:15 To turn on line numbers, go to OptionsShow Line Numbers. Often showing line numbers can be useful in longer or more complex code, allowing you to navigate around your code more easily and also pinpoint any issues that you may have.

03:30 And remember that everyone does have problems with their programs. IDLE has tools to help deal with these issues, and these will be covered in the next section of the course.

Become a Member to join the conversation.