[Python-Dev] New syntax for 'dynamic' attribute access (original) (raw)
"Martin v. Löwis" martin at v.loewis.de
Tue Feb 13 07:46:57 CET 2007
- Previous message: [Python-Dev] New syntax for 'dynamic' attribute access
- Next message: [Python-Dev] New syntax for 'dynamic' attribute access
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Ron Adam schrieb:
I think it's gets a bit awkward in some situations.
if bar->'%s_' % attr < -42: print 'Hello World'_ if bar.['%s' % attr] > -42: print 'Hello World' To me it's easier to parse the second one visually.
Ah, precedence.
It definitly should be a bracketed form, or else people always wonder what the precedence is, and add parenthesis anyway just to be on the safe side.
BTW, which of these would be correct
(a).[b] (a.)[b] a.[(b)] a.([b]) a . [ b ]
and what is the semantics of
a.[42]
Regards, Martin
- Previous message: [Python-Dev] New syntax for 'dynamic' attribute access
- Next message: [Python-Dev] New syntax for 'dynamic' attribute access
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]