Python Tuple實現原理
# 首先簡單瞭解一下 tuple 是什麽東西
元組(tuple)是 Python 存儲容器之一,最大特點就是,它是 immutable,像其他 list、dictionary、set 這些,都是 mutable
元組(tuple)是 Python 存儲容器之一,最大特點就是,它是 immutable,像其他 list、dictionary、set 這些,都是 mutable
getattr 是 Python 中的一個内建函數,在官方的 getattr 解釋中是這樣説明的
getattr(object, name[, default]) -> value | |
Get a named attribute from an object; getattr(x, 'y') is equivalent to x.y. | |
When a default argument is given, it is returned when the attribute doesn't | |
exist; without it, an exception is raised in that case. |