[Python-Dev] New syntax for 'dynamic' attribute access
Ton van Vliet
ton.vanvliet at skynet.be
Mon Feb 12 18:52:43 CET 2007
On Mon, 12 Feb 2007 18:50:35 +1100, you wrote:
>Yes and no. My point is that it's extremely similar to existing
>syntax. (Worse yet, it looks the same but for what's possibly the
>smallest and hardest-to-see character in any character set)
>
>"foo(baz)" vs "foo.(baz)" is... not good.
To me (as a newbee to the language) I only see possible confusion if one gives 'static' looking examples like:
x.(foo) += 1
which does indeed look a bit like a function call.
However when giving more 'dynamic' looking examples like:
x.('foo_%d' % n) += 1
I don't get confused at all and intuitively recognize the intention immediately. In this example I consider the parenthesis 'grouping operators' (which would not be the case when square brackets would have been used)
So, +1 for the idea from me, since the main intention is to use it in a 'dynamic' context, and there it would improve readability.
All IMHO as a newbee of course :)
Ton.
More information about the Python-Dev
mailing list