Book Image

Practical Maya Programming with Python

By : Robert Galanakis
Book Image

Practical Maya Programming with Python

By: Robert Galanakis

Overview of this book

Table of Contents (17 chapters)
Practical Maya Programming with Python
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Explaining types


There are many definitions of the computer science term type. There are so many, in fact, that choosing one is difficult. The best definition depends on what your perspective is. A compiler writer may see a type as an abstract mathematical entity. A statistics programmer may see it as a name and series of values. We will approach types from the perspective of a Python programmer who needs to get work done.

Note

I consider the terms type and class interchangeable in Python (though not in all other languages). It can be perhaps argued that they are not exactly the same, but for our purposes they are.

We'll start with the definition that a type is a name associated with some values. A name and value pair is called an attribute. Consider the following statement:

widget = PySide.QtCore.QWidget()

In that statement, the type of the widget variable is Pyside.QtCore.QWidget. By virtue of widget being an instance of the QWidget type, it has certain names and values. For example, widget...