3 ms·
Python's type system isn't very expressive-- for example, you have "list" and "dict" types but not "list of int" Sure you can. >> from array import array
by icebraining 12y ago
Python's type system isn't very expressive-- for example, you have "list" and "dict" types but not "list of int"
Sure you can.
>> from array import array
>> a = array('i')
>> a.append(3)
>> a
array('i', [3])
>> a.append('Hello')
TypeError: an integer is required
The default "list" type just happens to be an heterogeneous list.