namespace: convenience class for json like data

One thing that is cooler with java-script than in python is that
dictionaries and objects are the same thing. It allows browsing of
complex hierarchical data syntactically easy.

One will always prefer writing:
buildrequest.properties.myprop
rather than
brdict['properties']['myprop']

This class allows such syntax sugar, by converting a dictionary
to something that responds to both object and dictionary duck typing

We don't redo the mistakes of java-script model, and don't allow this
class to be inherited, and forbid to implement any specific method
apart from the '__' prefixed duck-typing
only keys() items() and values() are reserved and cannot be accessed
via object notation. they can only be accessed via dict like
notation

First implementation, that use an internal _dict attribute

    test_benchmark1 ...
create + access
pure dict          : 0.00572395324707
Namespace as dict  : 0.29655623436 ( 5180 %)
Namespace as object: 0.293313026428 ( 5124 %)
access only
pure dict          : 0.00226902961731
Namespace as dict  : 0.219506025314 ( 9674 %)
Namespace as object: 0.236507892609 ( 10423 %)
                                                   [OK]
    test_benchmark2 ...
create + access
pure dict          : 0.00633692741394
Namespace as dict  : 0.345242977142 ( 5448 %)
Namespace as object: 0.35455083847 ( 5594 %)
access only
pure dict          : 0.00258111953735
Namespace as dict  : 0.259343862534 ( 10047 %)
Namespace as object: 0.266692876816 ( 10332 %)
                                                   [OK]
    test_benchmark3 ...
create + access
pure dict          : 0.0107021331787
Namespace as dict  : 3.95416998863 ( 36947 %)
Namespace as object: 4.02670288086 ( 37625 %)
access only
pure dict          : 0.00716400146484
Namespace as dict  : 3.73691916466 ( 52162 %)
Namespace as object: 3.7946138382 ( 52967 %)
_Namespace as a dict subclass implementation

This needs copy of the actually data.
But dict like read access are then native

    test_benchmark1 ...
create + access
pure dict          : 0.00615882873535
Namespace as dict  : 0.456478118896 ( 7411 %)
Namespace as object: 0.478987932205 ( 7777 %)
access only
pure dict          : 0.00246000289917
Namespace as dict  : 0.00496506690979 ( 201 %)
Namespace as object: 0.0221290588379 ( 899 %)
                                                   [OK]
    test_benchmark2 ...
create + access
pure dict          : 0.00630712509155
Namespace as dict  : 0.768087148666 ( 12178 %)
Namespace as object: 0.792205810547 ( 12560 %)
access only
pure dict          : 0.00248885154724
Namespace as dict  : 0.00506806373596 ( 203 %)
Namespace as object: 0.0225648880005 ( 906 %)
                                                   [OK]
    test_benchmark3 ...
create + access
pure dict          : 0.0112509727478
Namespace as dict  : 9.57195401192 ( 85076 %)
Namespace as object: 9.70584011078 ( 86266 %)
access only
pure dict          : 0.00751686096191
Namespace as dict  : 0.027991771698 ( 372 %)
Namespace as object: 0.168903112411 ( 2246 %)

Signed-off-by: Pierre Tardy <pierre.tardy@intel.com>
try to avoid data copy. This does not work, as dict is a native
class, and its method cannot be changed.
Revert "try to avoid data copy. This does not work, as dict is a native"

This reverts commit 68b982561e3442ada73a9d0dbaf5960a43a68764.
namespace: final implementation

We translate inner dicts on the fly. This is thus
a good compromise

    test_benchmark1 ...
create + access
pure dict          : 0.00651502609253
Namespace as dict  : 0.152539968491 ( 2341 %)
Namespace as object: 0.173326015472 ( 2660 %)
access only
pure dict          : 0.00234913825989
Namespace as dict  : 0.0270440578461 ( 1151 %)
Namespace as object: 0.0485229492188 ( 2065 %)
                                                   [OK]
    test_benchmark2 ...
create + access
pure dict          : 0.00629901885986
Namespace as dict  : 0.31452703476 ( 4993 %)
Namespace as object: 0.336041927338 ( 5334 %)
access only
pure dict          : 0.00247311592102
Namespace as dict  : 0.154057979584 ( 6229 %)
Namespace as object: 0.179447889328 ( 7255 %)
                                                   [OK]
    test_benchmark3 ...
create + access
pure dict          : 0.0114121437073
Namespace as dict  : 0.848978042603 ( 7439 %)
Namespace as object: 1.067289114 ( 9352 %)
access only
pure dict          : 0.00813007354736
Namespace as dict  : 0.208504915237 ( 2564 %)
Namespace as object: 0.392553091049 ( 4828 %)
more optimization

After reflexion, it looks that we need to optimize read access
time rather than creation time.
remove the inheritence forbid from the specs

Implementing it will impact performance
http://code.activestate.com/recipes/141933-forbidding-inheritance/


Signed-off-by: Pierre Tardy <pierre.tardy@intel.com>
Merge branch 'yamlconfig' of git://github.com/tardyp/buildbot