Page 209 -
P. 209
6 custom data objects
Bundling code with data
The object of my desire
[sigh] is in a class of
her own.
It’s important to match your data structure choice to your data.
And that choice can make a big difference to the complexity of your code. In Python,
although really useful, lists and sets aren’t the only game in town. The Python dictionary
lets you organize your data for speedy lookup by associating your data with names, not
numbers. And when Python’s built-in data structures don’t quite cut it, the Python class
statement lets you define your own. This chapter shows you how.
this is a new chapter 173