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 1. Primitives

Computer programs manipulate data. This chapter describes the simplest kinds of Python data and the simplest ways of manipulating them. An individual item of data is called a value. Every value in Python has a type that identifies the kind of value it is. For example, the type of 2 is int. You’ll get more comfortable with the concepts of types and values as you see more examples.

The Preface pointed out that Python is a multiparadigm programming language. The terms “type” and “value” come from traditional procedural programming. The equivalent object-oriented terms are class and object. We’ll mostly use the terms “type” and “value” early on, then gradually shift to using “class” and “object” more frequently. Although Python’s history is tied more to object-oriented programming than to traditional programming, we’ll use the term instance with both terminologies: each value is an instance of a particular type, and each object is an instance of a particular class.

Simple Values

Types for some simple kinds of values are an integral part of Python’s implementation. Four of these are used far more frequently than others: logical (Boolean), integer, float, and string. There is also a special no-value value called None.

When you enter a value in the Python interpreter, it prints it on the following line:

>>> 90
90
>>>

When the value is None, nothing is printed, since None means “nothing”:

>>> None
>>>

If you type something Python finds unacceptable in some way, you will see ...

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