Spot Typos at a Glance

00:00 Spot Typos at a Glance. Compared to bpython, the Python standard REPL is like an old black-and-white TV. It does the job of accurately conveying information, but sometimes you wish to see things in color for greater clarity.

00:16 That’s particularly important during code editing, where every detail matters. Therefore, syntax highlighting and bracket matching are perhaps the most common features found in any decent IDE or code editor. In bpython, you get both features out of the box, even though it’s only a text-based user interface to the Python REPL.

00:37 Full syntax highlighting helps you identify the structure of your code at a glance, while bracket matching makes it easier to keep the opening and closing brackets correctly balanced. As you type code into bpython, your instructions get tokenized into Python keywords, operators, comments, variables, and literal values, such as strings, numbers, or Booleans.

01:00 Each token type has an associated color to let you quickly see what kind of language construct you are working with.

01:17 This tokenizing and coloring isn’t done by bpython directly, but by the Pygments library used under the surface. Later you’ll see how to customize the color theme in bpython.

01:30 In addition to providing syntax highlighting, bpython also lets you know if the opening and closing brackets in your code are correctly balanced. When you type a closing bracket, bpython will highlight the corresponding opening bracket and the other way round.

01:45 And when you move your cursor to any bracket, it will highlight its corresponding one.

01:58 This works with different kinds of brackets in Python, including brackets, braces, and parentheses. You can even nest them inside each other, and whenever you select one, bpython will highlight the other one that corresponds to it. In

02:18 the next section of the course, you’ll see how bpython can help you type more quickly and accurately.

Become a Member to join the conversation.