Get and set not possible for class members
namespaces.py
# -*- coding: utf-8 -*-
import namespaces
ns = namespaces.Namespace(a=1, b=2)
fns = namespaces.FrozenNamespace(ns)
print fns.b
# 2
ns.c
# AttributeError: 'Namespace' object has no attribute 'c'
ns.c = 3
print ns.c
# 3
fns.c = 3
# AttributeError: 'FrozenNamespace' object has no attribute '__setattr__'
Recommended Posts