[Python-Dev] New syntax for 'dynamic' attribute access
Guido van Rossum
guido at python.org
Mon Feb 12 16:55:22 CET 2007
My perspective:
- There's a lot of support for the basic idea, and only a few
naysayers, so let's keep looking for a syntax that works.
- There's near-universal dislike for the two-arg form, so let's drop
that part of the proposal.
- I can't recall that x.[y] has been proposed yet, but thinking about
it, that actually makes more sense than x.(y). (In fact, in JavaScript
you can write x[y] to the same effect. I wouldn't discount the JS
example; JS is probably closer to Python than almost any other
language currently in existence except for Boo, and JS has
successfully borrowed from Python.)
- I'm not too concerned by the '.' being such a small character with
this new proposal. x[y] is a lot less common than x(y), so you'll look
twice when you think you see x[y] and it doesn't make sense, and then
you'll notice it's really x.[y], which you either know or don't, and
in the latter case you'll be looking it up or asking around.
PS Thanks to Ben for excellent summaries of the discussion so far!
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev
mailing list