Nominal type 是那些在Python解释器中具有名称的类型。 例如所有内置类型(int,bolean,float,type,object等),然后我们有通用类型 (generic types),它们主要以容器的形式表现出来: t : Tuple[int, float] =0,1.2 d : Dict[str, int] = {"a":1,"b":2} d : MutableMapping[str, int] = {"a":1,"b...
TypeError: 'tuple' object does not support item assignment >>> #but they can contain mutable object >>> v=([1,2,3],[4,53]) >>> v[0].append('a') >>> v ([1, 2, 3, 'a'], [4, 53]) >>> 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. Vie...
1 class str(object) 2 | str(object='') -> str 3 | str(bytes_or_buffer[, encoding[, errors]]) -> str 4 | 5 | Create a new string object from the given object. If encoding or 6 | errors is specified, then the object must expose a data buffer 7 | that will be decoded usin...
例如所有内置类型(int,bolean,float,type,object等),然后我们有通用类型 (generic types),它们主要以容器的形式表现出来: t : Tuple[int, float] =0,1.2 d : Dict[str, int] = {"a":1,"b":2} d : MutableMapping[str, int] = {"a":1,"b":2} l : List[int] = [1,2,3] i : Iterab...