diff --git a/native-datatypes.html b/native-datatypes.html index 044e74c..9a1c1a5 100755 --- a/native-datatypes.html +++ b/native-datatypes.html @@ -31,7 +31,7 @@ body{counter-reset:h1 2}
  • Sets are unordered bags of values.
  • Dictionaries are unordered bags of key-value pairs. -

    Of course, there are a lot more types than these seven. Everything is an object in Python, so there are types like module, function, class, method, file, and even compiled code. You’ve already seen some of these: modules have names, functions have docstrings, &c. You’ll learn about classes in Classes & Iterators, and about files in [FIXME xref]. +

    Of course, there are a lot more types than these seven. Everything is an object in Python, so there are types like module, function, class, method, file, and even compiled code. You’ve already seen some of these: modules have names, functions have docstrings, &c. You’ll learn about classes in Classes & Iterators, and about files in Files.

    Strings and bytes are important enough — and complicated enough — that they get their own chapter. Let’s look at the others first.

    ⁂ @@ -695,7 +695,7 @@ KeyError: 'pop from an empty set'

    A dictionary in Python is like a hash in Perl 5. In Perl 5, variables that store hashes always start with a % character. In Python, variables can be named anything, and Python keeps track of the datatype internally.

    Creating A Dictionary

    -

    Creating a dictionary is easy. The syntax is similar to sets [FIXME link fails because section is not written yet], but instead of values, you have key-value pairs. Once you have a dictionary, you can look up values by their key. +

    Creating a dictionary is easy. The syntax is similar to sets, but instead of values, you have key-value pairs. Once you have a dictionary, you can look up values by their key.

     >>> a_dict = {'server': 'db.diveintopython3.org', 'database': 'mysql'}  
     >>> a_dict
    @@ -758,7 +758,7 @@ KeyError: 'db.diveintopython3.org'
    >>> SUFFIXES[1000][3] 'TB'
      -
    1. Like lists and sets [FIXME-xref], the len() function gives you the number of keys in a dictionary. +
    2. Like lists and sets, the len() function gives you the number of keys in a dictionary.
    3. And like lists and sets, you can use the in operator to test whether a specific key is defined in a dictionary.
    4. 1000 is a key in the SUFFIXES dictionary; its value is a list of eight items (eight strings, to be precise).
    5. Similarly, 1024 is a key in the SUFFIXES dictionary; its value is also a list of eight items.