Skip to Content
Bioinformatics Programming Using Python
book

Bioinformatics Programming Using Python

by Mitchell L Model
December 2009
Intermediate to advanced
521 pages
15h 26m
English
O'Reilly Media, Inc.
Content preview from Bioinformatics Programming Using Python

Chapter 4. Control Statements

Note

This chapter’s material is rich and intellectually challenging. Don’t give up if you start to feel lost (but do review it later to make sure you have absorbed it all). This chapter, together with the next, will complete our introduction to Python. To help you understand its contents, the chapter ends with some extended examples that reiterate the points made in its shorter examples. The rest of the book has a very different flavor.

Chapters 1 and 2 introduced simple statements:

  • Expressions, including function calls

  • Assignments

  • Augmented assignments

  • Various forms of import

  • Assertions

  • return

  • yield (to implement generators)

  • pass

They also introduced the statements def, for defining functions, and with, to use with files.[20] These are compound statements because they require at least one indented statement after the first line. This chapter introduces other compound statements. As with def and with, the first line of every compound statement must end with a colon and be followed by at least one statement indented relative to it. Unlike def and with statements, though, the other compound statements do not name anything. Rather, they determine the order in which other statements are executed. That order is traditionally called the control flow or flow of control, and statements that affect it are called control statements.[21]

Some kinds of compound statements can or must have more than one clause. The first line of each clause of a compound statement—its header ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Bioinformatics with Python Cookbook - Third Edition

Bioinformatics with Python Cookbook - Third Edition

Tiago Antao

Publisher Resources

ISBN: 9780596804725Supplemental ContentErrata Page