The Python release archive is a nice repository for archaeological findings. My biggest surprise was the existence of an access statement and `access` keyword in the pre-history of Python 1.5.0. The syntax was already specified in release 1.0 with an accompanying `accessobject.c` and it began to fade in Python 1.4.
The access statementThat is how the access statement was defined in 1.0
access_stmt: 'access' ('*' | NAME (',' NAME)*) ':' accesstype (',' accesstype)* accesstype: NAME+ # accesstype should be ('public' | 'protected' | 'private') ['read'] ['write'] # but can't be because that would create undesirable reserved words!
The `access_stmt` was a small statement i.e. one that doesn’t contain a block and could be used like `print`, `del` or `exec`.
So the proper use of the access statement would be like
class Point: access x, y, z: private write, public read
or more compact:
class Point: access *: private write, public read
The word `public` wasn’t a language keyword which made it possible to use it in this way:
class AccessModifier: access public: public access private: public access protected: public
Note that the access statement was purely declarative even more so than Java’s where you can write
public int x = 10;
and define `x` while specifying its type and access modifier. It was also more elaborated in terms of intended protections by means of differentiating between `read` and `write`.
How it never took off and gone awayIn the `HISTORY` file of Python 1.0 we find the notice
There’s a new reserved word: “access”. The syntax and semantics are
still subject of of research and debate (as well as undocumented), but
the parser knows about the keyword so you must not use it as a
variable, function, or attribute name.
In Python 1.4 the access statement was already uncommented from the `Grammar`.
The story ends with the following remark in the `HISTORY` of Python 1.5:
‘access’ is no longer a reserved word, and all code related to its
implementation is gone (or at least #ifdef’ed out). This should make
Python a little speedier too!
And I can remember working with Python 1.4, and I have vague recollections of the existence of access as a reserved word. Archaeology, indeed! 🙂