I l@ve RuBoard |
In this chapter, we've met Python's built-in object types—numbers, strings, lists, dictionaries, tuples, and files—along with the operations Python provides for processing them. We've also noticed some of the themes underlying objects in Python along the way; in particular, the notions of operation overloading and type categories help to simplify types in Python. Finally, we've seen a few common pitfalls of built-in types.
Almost all the examples in this chapter were deliberately artificial to illustrate the basics. In the next chapter, we'll start studying statements that create and process objects and let us build up programs that do more realistic work.
Other Types in PythonBesides the core objects we've studied in this chapter, a typical Python installation has dozens of other object types available as linked-in C extensions or Python classes. We'll see examples of a few later in the book—regular expression objects, DBM files, GUI widgets, and so on. The main difference between these extra tools and the built-in types we've just seen is that the built-ins provide special language creation syntax for their objects (e.g., 4 for an integer, [1,2] for a list, the open function for files). Other tools are generally exported in a built-in module that you must first import to use. See Python's library reference for a comprehensive guide to all the tools available to Python programs. |
I l@ve RuBoard |