[Python-Dev] New syntax for 'dynamic' attribute access

Scott Dial scott+python-dev at scottdial.com
Tue Feb 13 01:33:45 CET 2007


Raymond Hettinger wrote:
> Rather than munge existing syntaxes, an altogether new one would be more clear:
> 
>    self->name = self.metadata->name
> 

My problem with this is that it isn't a "name". It should grammatically 
be a test (i.e. it can take on the expression any function argument 
could take).

How do you spell "getattr(self, 'req_' + state)" with that arrow? You 
need some kind of grouping delimiters to make this operator be a syntax 
benefit otherwise you didn't shorten anything.

-Scott

-- 
Scott Dial
scott at scottdial.com
scodial at cs.indiana.edu


More information about the Python-Dev mailing list