[Python-checkins] peps: Deferred to Python 2.1
georg.brandl
python-checkins at python.org
Wed Mar 23 21:26:20 CET 2011
http://hg.python.org/peps/rev/68ded446ef9a
changeset: 136:68ded446ef9a
user: Barry Warsaw <barry at python.org>
date: Wed Aug 23 05:47:12 2000 +0000
summary:
Deferred to Python 2.1
files:
pep-0213.txt | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/pep-0213.txt b/pep-0213.txt
--- a/pep-0213.txt
+++ b/pep-0213.txt
@@ -1,9 +1,12 @@
PEP: 213
Title: Attribute Access Handlers
Version: $Revision$
-Owner: paul at prescod.net (Paul Prescod)
-Python-Version: 2.0
-Status: Incomplete
+Author: paul at prescod.net (Paul Prescod)
+Status: Draft
+Type: Standards Track
+Python-Version: 2.1
+Created: 21-Jul-2000
+Post-History:
Introduction
@@ -19,6 +22,7 @@
This PEP describes a feature that makes it easier, more efficient
and safer to implement these handlers for Python instances.
+
Justification
Scenario 1:
@@ -50,6 +54,7 @@
for whatever purpose. Again, this is not a new feature but
merely a new syntax for an existing convention.
+
Current Solution
To make some attributes read-only:
@@ -85,6 +90,7 @@
mitigated through an extra level of method call but this is
inefficient.
+
Proposed Syntax
Special methods should declare themselves with declarations of the
@@ -105,7 +111,8 @@
x.foo=fooval+5
del x.foo
- Semantics
+
+Semantics
Attribute references of all three kinds should call the method.
The op parameter can be "get"/"set"/"del". Of course this string
@@ -125,6 +132,7 @@
opposite choice seems fairly feasible also, however. The same
goes for __del_y__.
+
Proposed Implementation
There is a new object type called an attribute access handler.
@@ -169,6 +177,7 @@
The implementation of delete is analogous to the implementation
of set.
+
Caveats
1. You might note that I have not proposed any logic to keep
@@ -199,6 +208,8 @@
on the object itself can cause an infinite loop (as with __getattr__)
Once again, the solution is to use a special (typically private)
variable such as __XXX.
+
+
Local Variables:
mode: indented-text
--
Repository URL: http://hg.python.org/peps
More information about the Python-checkins
mailing list