Martin v. Löwis wrote:
> Ron Adam schrieb:
>> Would it be possible for attrview to be a property?
> 
> Sure. It might conflict with a proper name of an attribute, of course.
> 
>> Something like...  (Probably needs more than this to handle all cases.)
>>
>>      class obj(object):
>>          def _attrview(self):
>>              return self.__dict__
>>          attr = property(_attrview)
> 
> That wouldn't work: you really need to invoke the entire attribute 
> lookup machinery (e.g. to find methods, invoke properties, and so
> on). Also, for 2.6, it wouldn't support old-style classes.
> 
> Regards,
> Martin


Yes, I thought that might be a problem.


So I guess I'm for the shortened version which wouldn't conflict with a 
property 
and could be made to work in more cases.

     +1   obj.[foo]


I don't care for the longer attrview() as it adds another level of 
indirectness. 
  I feel that is a counter solution to the point of the suggested syntax.

Ron


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to