An unscrupulous pickpocket can reach out and nab private members easily. Assume a module box with:
from lang.access import enforce_private
@enforce_private
class Box(object):
def __init__(self):
self._cheese_ = 42
Then, at the REPL:
>>> import box
>>> b = box.Box()
>>> vars(b)["_cheese_"]
42
>>> b.__dict__["_cheese_"]
42
This attack is mitigated by the use of __slots__, on Python interpreters which support slotted classes, but see #4 for something more durable.
Edit: Slots.
An unscrupulous pickpocket can reach out and nab private members easily. Assume a module
boxwith:Then, at the REPL:
This attack is mitigated by the use of
__slots__, on Python interpreters which support slotted classes, but see #4 for something more durable.Edit: Slots.