Housekeeping Reminder The convert.txt
assignment is due today. Many of you have already submitted and I have
graded all submission as of about 8A today. Live now are the two
Python assignments lab1.html
and bit_players.html
.
Da Quiz This is in Canvas. You can start work when you arrive; it opens 5 min before class begins.
The Python Documentation
Builtin Types Page Let's go here and see information on the types we have seen so far. Chapter 2 gives coverage of several of these. You will get a tour of this and we will try to use it to solve some problems.
What is a object? An object is any items stored in memory. All data are objects. So far, we know about numbers, strings and booleans. Object have three important features.
- state This is what an object KNOWS.
- identity This refers to an object's physical presence in memory.
- behavior This is what an object DOES.
What is a method, as opposed to a function? A
function is a free agent, unattached to any object. A method
is attached to an object, and often depends on the object's state.
For example, len
is a function
that computes the length of any string you hand it. It depends on
the number of characters in a string's character sequence. The
abs
function computes the absolute value of any
number you pass it, including complex ones. Here we see a method at work.
>>> x = "cat"
>>> x.upper()
CAT
The method upper
is a string method. The . is indicative
of the genitive case; this is x
's upper
method.
Method calls always have the apperance object.method(.....)
Builtin Functions Page This page has a complete list of them. We will do a little spelunking here and check this out. As you progress, you will learn more of these. You should visit this from time to time, as you will see some useful stuff that will come in handy as we progress through the language.