| Python Library Reference |
According to the dictionary, a bastion is ``a fortified area orposition'', or ``something that is considered a stronghold.'' It's asuitable name for this module, which provides a way to forbid accessto certain attributes of an object. It must always be used with therexec module, in order to allow restricted-mode programsaccess to certain safe attributes of an object, while denying accessto other, unsafe attributes.
If present,filter must be a function that accepts a stringcontaining an attribute name, and returns true if access to thatattribute will be permitted; iffilter returns false, the accessis denied. The default filter denies access to any function beginningwith an underscore ("_"). The bastion's string representationwill be "<Bastion forname>" if a value forname is provided; otherwise, "repr(object)" will beused.
class, if present, should be a subclass ofBastionClass; see the code inbastion.py for the details. Overriding thedefaultBastionClass will rarely be required.
| Python Library Reference |