Deferred to Python 2.1

This commit is contained in:
Barry Warsaw 2000-08-23 05:47:12 +00:00
parent 211538dfe9
commit 08414d30a6
1 changed files with 15 additions and 4 deletions

View File

@ -1,9 +1,12 @@
PEP: 213
Title: Attribute Access Handlers
Version: $Revision$
Owner: paul@prescod.net (Paul Prescod)
Python-Version: 2.0
Status: Incomplete
Author: paul@prescod.net (Paul Prescod)
Status: Draft
Type: Standards Track
Python-Version: 2.1
Created: 21-Jul-2000
Post-History:
Introduction
@ -19,6 +22,7 @@ Introduction
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 @@ Justification
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 @@ Current Solution
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 @@ Proposed Syntax
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 @@ Proposed Syntax
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 @@ Proposed Implementation
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 @@ Caveats
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