[Python-bugs-list] [ python-Bugs-485240 ] extra arg 'name' for __get|set|del__

noreply@sourceforge.net noreply@sourceforge.net
Sat, 24 Nov 2001 20:24:45 -0800


Bugs item #485240, was opened at 2001-11-24 19:41
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=485240&group_id=5470

Category: Type/class unification
Group: Feature Request
>Status: Closed
>Resolution: Rejected
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Guido van Rossum (gvanrossum)
Summary: extra arg 'name' for __get|set|del__

Initial Comment:
Hello. I am writing an object oriented database 
library for Python I call ObjFS. While rewriting it 
for Python 2.2, I found that the special methods 
__get__, __set__ & __del__ would definately benefit 
from having the attribute's name as an extra argument:

def __get__(self, container, name, oftype=None):
def __set__(self, container, name, value):
def __del__(self, container, name):

In my case, I am using those attribute names to build 
database keys (a tuple of attribute names ordered 
from top most container to the current attribute's 
name) to distribute database content on a shelve 
database. 

Without the extra argument, I must hack my own 
solution using __getattribute__, __setattr__ & 
__delattr__ (which still achieves 12000 writes/second 
on my PIII-800). I wouldn't want Python to change on 
my accord, but I was wondering what the reason was 
for excluding the argument's name in __get__, __set__ 
& __del__. The reason I mention this is if it is 
useful to me, I'm certain it might be useful to many 
other people. 






----------------------------------------------------------------------

>Comment By: Guido van Rossum (gvanrossum)
Date: 2001-11-24 20:24

Message:
Logged In: YES 
user_id=6380

Passing the name would be redundant for the typical use,
where each attribute is described by a separate descriptor.
I guess you're using it slightly wrong, attempting to use a
single descriptor to describe multiple attributes.

(BTW, who are you?  Please log in!  Also, better come up
with a more imaginative name than ObjFS. :-)



----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=485240&group_id=5470