How to use the dotmap.__init__.PropertyDotMap function in dotmap

To help you get started, we’ve selected a few dotmap examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github drgrib / dotmap / dotmap / __init__.py View on Github external
my.x.y.z = 3
    print(my)


    # subclass with existing property
    class PropertyDotMap(MyDotMap):
        def __init__(self, *args, **kwargs):
            super(MyDotMap, self).__init__(*args, **kwargs)
            self._myprop = MyDotMap({'nested': 123})

        @property
        def first(self):
            return self._myprop


    p = PropertyDotMap()
    print(p.first)
    print(p.first.nested)
    p.first.second.third = 456
    print(p.first.second.third)

    # final print
    print()

dotmap

ordered, dynamically-expandable dot-access dictionary

MIT
Latest version published 2 years ago

Package Health Score

59 / 100
Full package analysis

Similar packages