def public(*attributes)return accesscontrol(failif=(lambda attrattr not in attributes)see the prior example' self-test code for usage example here' quick look at these class decorators in action at the interactive promptthey work the same in and for attributes referenced by explicit name like those tested here as advertisednonprivate or public names can be fetched and changed from outside the subject classbut private or non-public names cannotfrom access import privatepublic @private('age'class persondef __init__(selfnameage)self name name self age age person('bob' name 'bobx name 'suex name 'suex age typeerrorprivate attribute fetchage age 'tomtypeerrorprivate attribute changeage person private('age')(personperson oninstance with state inside accesses run normally outside accesses validated @public('name'class persondef __init__(selfnameage)self name name self age age person('bob' name 'bobx name 'suex name 'suex age typeerrorprivate attribute fetchage age 'tomtypeerrorprivate attribute changeage is an oninstance oninstance embeds person implementation details ii to help you analyze the codehere are few final notes on this version since this is just generalization of the preceding section' versionthe implementation notes there apply here as well decorators