Show
Ignore:
Timestamp:
03/05/10 23:11:34 (2 years ago)
Author:
hodgestar
Message:

Dictionaries and sets.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • hodgestar/Talks/PythonForProgrammers/slides/py4prog.py

    r729 r730  
    191191 
    192192    Slide("Dictionaries and Sets", 
    193         Bullet("Dictionaries:", 
    194         ), 
    195         Bullet("Sets:", 
    196         ), 
     193        Bullet("Dictionaries:", PYCON(''' 
     194            >>> a = { 1: 'a', 2: 4, 3: None, 5: textutil, (1, 2, 3): [] } 
     195            >>> a[3] 
     196            >>> b = a.copy() 
     197            >>> b[5] 
     198            <module 'textutil' from 'textutil/__init__.pyc'> 
     199            >>> del b[5] 
     200            ''')), 
     201        Bullet("Sets:", PYCON(''' 
     202            >>> set("elephant") 
     203            set(['a', 'e', 'h', 'l', 'n', 'p', 't']) 
     204            ''')), 
     205        Bullet("Python 3 has dict-like set syntax: { 1, 2, 3 }"), 
    197206    ), 
    198207