Page 44 -
P. 44
not my type
Hang on a second! Aren’t you
forgetting something? Don’t you need to
declare type information for your list?
No, because Python’s variable identifiers
don’t have a type.
Many other programming languages insist that every
identifier used in code has type information declared for
it. Not so with Python: identifiers are simply names that
refer to a data object of some type.
Think of Python’s list as a high-level collection. The
type of the data items is not important to the list. It’s
OK to state that your movies list is a “collection of
strings,” but Python doesn’t need to be told this. All
Python needs to know is that you need a list, you’ve
given it a name, and the list has some data items in it.
8 Chapter 1