App Engine Python SDK  v1.6.9 rev.445
The Python runtime is available as an experimental Preview feature.
Public Member Functions | List of all members
google.appengine._internal.django.utils.datastructures.DotExpandedDict Class Reference
Inheritance diagram for google.appengine._internal.django.utils.datastructures.DotExpandedDict:

Public Member Functions

def __init__
 

Detailed Description

A special dictionary constructor that takes a dictionary in which the keys
may contain dots to specify inner dictionaries. It's confusing, but this
example should make sense.

>>> d = DotExpandedDict({'person.1.firstname': ['Simon'], \
        'person.1.lastname': ['Willison'], \
        'person.2.firstname': ['Adrian'], \
        'person.2.lastname': ['Holovaty']})
>>> d
{'person': {'1': {'lastname': ['Willison'], 'firstname': ['Simon']}, '2': {'lastname': ['Holovaty'], 'firstname': ['Adrian']}}}
>>> d['person']
{'1': {'lastname': ['Willison'], 'firstname': ['Simon']}, '2': {'lastname': ['Holovaty'], 'firstname': ['Adrian']}}
>>> d['person']['1']
{'lastname': ['Willison'], 'firstname': ['Simon']}

# Gotcha: Results are unpredictable if the dots are "uneven":
>>> DotExpandedDict({'c.1': 2, 'c.2': 3, 'c': 1})
{'c': 1}

The documentation for this class was generated from the following file: