displaying 1 - 1 bookmarks in total 1


  • A Simple Namespace Class (Python recipe)

    Every object in python has a namespace, the mapping of attributes to values for that object. The namespace of an object is exposed by its __dir__() special method, effectively an "object namespace protocol". Some objects also represent separate namespaces. This includes mappings (like dict), sequences (like list or str), modules, and classes. Sometimes you just want to create a simple namespace that is easy to use, like a regular object.
    Oct 1, 2011, 2:20:45 PM