• Jeremy Hylton's avatar
    Simplify and cleanup implementation of PersistentMapping. · abc8eb11
    Jeremy Hylton authored
    The implementation now defers all implementation decisions to UserDict
    and merely handles updates to _p_changed in the PersistentMapping
    implementation.  This change simplifies the implementation and ensures
    that it implements all the new methods of dictionaries like popitem()
    and setdefault().
    
    There is one (important?) behavioral change:  The old implementation
    of the keys() method did not return keys that were strings starting
    with underscore.  This behavior was undocumented and could lead to
    problems for implementations that expect keys() to working like a
    regular mapping.
    
        The feature was removed after verifying that the Zope test suite
        does not depend on this behavior.
    
    An internal implementation change is that the PersistentMapping does
    not keep a copy of the keys() of the dict.  It simplifies the
    implementation a lot to remove the cacheing and the benefit is
    unclear.  It only benefits applications that call keys() frequently
    without modifying the dict.  And it requires that two copies of the
    list exist for each call to keys() which may require a lot of space.
    abc8eb11
mapping.py 5.22 KB