Lec21-Representation
Contents
Representation
Strings
一个是Python表达式(解释器可以直接运行的形式),一个是字符串(人类可读的形式)
repr
|
|
str
|
|
F-Strings
{ }
里面的按照表达式来计算
|
|
多态函数
Functions that apply to many different forms of data…
|
|
实现 __repr__
和 __str__
方法
__repr__
: Only class attributes are found! Ignore instance attributes.__str__
: Ignore instance attributes. If no__str__
method is defined, it will use__repr__
method.
|
|
Interfaces
类似61B的课程,实现接口(长得像是__xx__
)
喜欢Java 😋
special methods
群 贤 毕 至
终于和cmu 10-414对上了
左右值