DOC PREVIEW
Berkeley COMPSCI 61A - Lecture 17

This preview shows page 1-2-3-4-5-6-7-50-51-52-53-54-55-56-100-101-102-103-104-105-106 out of 106 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 106 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 106 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 106 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 106 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 106 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 106 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 106 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 106 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 106 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 106 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 106 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 106 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 106 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 106 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 106 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 106 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 106 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 106 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 106 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 106 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 106 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 106 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

61A Lecture 17Friday, October 7Friday, October 7, 2011Today is Ada Lovelace Day2Images from WikipediaFriday, October 7, 2011Today is Ada Lovelace DayAda Lovelace, born 1815, was a writer, mathematician, and correspondent of Charles Babbage2Images from WikipediaFriday, October 7, 2011Today is Ada Lovelace DayAda Lovelace, born 1815, was a writer, mathematician, and correspondent of Charles Babbage2Images from WikipediaFriday, October 7, 2011Today is Ada Lovelace DayAda Lovelace, born 1815, was a writer, mathematician, and correspondent of Charles BabbageCharles Babbage designed the "analytical engine"2Images from WikipediaFriday, October 7, 2011Today is Ada Lovelace DayAda Lovelace, born 1815, was a writer, mathematician, and correspondent of Charles BabbageCharles Babbage designed the "analytical engine"2Images from WikipediaFriday, October 7, 2011Today is Ada Lovelace DayAda Lovelace, born 1815, was a writer, mathematician, and correspondent of Charles BabbageCharles Babbage designed the "analytical engine"Ada wrote its first program(to compute Bernoulli numbers)2Images from WikipediaFriday, October 7, 2011Generic Functions3Friday, October 7, 2011Generic FunctionsAn abstraction might have more than one representation3Friday, October 7, 2011Generic FunctionsAn abstraction might have more than one representation•Python has many sequence types: tuples, ranges, lists, etc.3Friday, October 7, 2011Generic FunctionsAn abstraction might have more than one representation•Python has many sequence types: tuples, ranges, lists, etc.An abstract data type might have multiple implementations3Friday, October 7, 2011Generic FunctionsAn abstraction might have more than one representation•Python has many sequence types: tuples, ranges, lists, etc.An abstract data type might have multiple implementations•Some representations are better suited to some problems3Friday, October 7, 2011Generic FunctionsAn abstraction might have more than one representation•Python has many sequence types: tuples, ranges, lists, etc.An abstract data type might have multiple implementations•Some representations are better suited to some problemsA function might want to operate on multiple data types3Friday, October 7, 2011Generic FunctionsAn abstraction might have more than one representation•Python has many sequence types: tuples, ranges, lists, etc.An abstract data type might have multiple implementations•Some representations are better suited to some problemsA function might want to operate on multiple data types3Today's Topics:Friday, October 7, 2011Generic FunctionsAn abstraction might have more than one representation•Python has many sequence types: tuples, ranges, lists, etc.An abstract data type might have multiple implementations•Some representations are better suited to some problemsA function might want to operate on multiple data types3Today's Topics:•Generic functions using message passingFriday, October 7, 2011Generic FunctionsAn abstraction might have more than one representation•Python has many sequence types: tuples, ranges, lists, etc.An abstract data type might have multiple implementations•Some representations are better suited to some problemsA function might want to operate on multiple data types3Today's Topics:•Generic functions using message passing•String representations of objectsFriday, October 7, 2011Generic FunctionsAn abstraction might have more than one representation•Python has many sequence types: tuples, ranges, lists, etc.An abstract data type might have multiple implementations•Some representations are better suited to some problemsA function might want to operate on multiple data types3Today's Topics:•Generic functions using message passing•String representations of objects•Multiple representations of abstract data typesFriday, October 7, 2011Generic FunctionsAn abstraction might have more than one representation•Python has many sequence types: tuples, ranges, lists, etc.An abstract data type might have multiple implementations•Some representations are better suited to some problemsA function might want to operate on multiple data types3Today's Topics:•Generic functions using message passing•String representations of objects•Multiple representations of abstract data types•Property methods Friday, October 7, 2011String Representations4Friday, October 7, 2011String RepresentationsAn object value should behave like the kind of data it is meant to represent4Friday, October 7, 2011String RepresentationsAn object value should behave like the kind of data it is meant to representFor instance, by producing a string representation of itself4Friday, October 7, 2011String RepresentationsAn object value should behave like the kind of data it is meant to representFor instance, by producing a string representation of itselfStrings are important: they represent language and programs4Friday, October 7, 2011String RepresentationsAn object value should behave like the kind of data it is meant to representFor instance, by producing a string representation of itselfStrings are important: they represent language and programsIn Python, all objects produce two string representations4Friday, October 7, 2011String RepresentationsAn object value should behave like the kind of data it is meant to representFor instance, by producing a string representation of itselfStrings are important: they represent language and programsIn Python, all objects produce two string representations•The "str" is legible to humans4Friday, October 7, 2011String RepresentationsAn object value should behave like the kind of data it is meant to representFor instance, by producing a string representation of itselfStrings are important: they represent language and programsIn Python, all objects produce two string representations•The "str" is legible to humans•The "repr" is legible to the Python interpreter4Friday, October 7, 2011String RepresentationsAn object value should behave like the kind of data it is meant to representFor instance, by producing a string representation of itselfStrings are important: they represent language and programsIn Python, all objects produce two string representations•The "str" is legible to humans•The "repr" is legible to the Python interpreterWhen the "str" and "repr" strings are the same, we're doing something right in our programming language!4Friday, October 7, 2011The "repr" String for an Object5Friday, October 7, 2011The "repr" String for


View Full Document

Berkeley COMPSCI 61A - Lecture 17

Documents in this Course
Lecture 1

Lecture 1

68 pages

Midterm

Midterm

5 pages

Midterm

Midterm

6 pages

Lecture 35

Lecture 35

250 pages

Lecture 14

Lecture 14

125 pages

Lecture 2

Lecture 2

159 pages

Lecture 6

Lecture 6

113 pages

Lecture 3

Lecture 3

162 pages

Homework

Homework

25 pages

Lecture 13

Lecture 13

117 pages

Lecture 29

Lecture 29

104 pages

Lecture 11

Lecture 11

173 pages

Lecture 7

Lecture 7

104 pages

Midterm

Midterm

6 pages

Midterm

Midterm

6 pages

Lecture 8

Lecture 8

108 pages

Lab 4

Lab 4

4 pages

Lecture 7

Lecture 7

52 pages

Lecture 20

Lecture 20

129 pages

Lecture 15

Lecture 15

132 pages

Lecture 9

Lecture 9

95 pages

Lecture 30

Lecture 30

108 pages

Load more
Download Lecture 17
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 17 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 17 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?