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

Terry Reedy tjreedy at udel.edu
Mon Feb 12 04:19:07 CET 2007


"Ben North" <ben at redfrontdoor.org> wrote in message 
news:45CFAA81.5040906 at redfrontdoor.org...
| so here I am.  Does anybody have any opinions/suggestions, particularly
| on the "open questions" referred to in the draft PEP?  To summarise
| these open questions:

Need: Runtime attributes are a fairly frequent 'How?' question on c.l.p.

Syntax: I initially did not like it and was surprised at its current 
invalidity (I expected the 'surperfluous' parens to be ignored) but could 
not think of anything better, and after 10 min. it looks better for a 
couple of reasons.  First, I vaguely remember () being used for a similar 
purpose of indicating indirection in some assembly languages.  Second, 
parens are already special cased as the call operator when following an 
object expression (without an intervening operator).  So I can swallow a 
new special case when they follow '.'.

The 'two-arg' form: this analogizes .() as being like a obj() call, but the 
sematics are different enough that I think it confuses.  So I suggest drop 
it at least for now.

Terry Jan Reedy





More information about the Python-Dev mailing list