dynamic attribute syntax

castironpi castironpi at gmail.com
Sun Aug 17 21:29:30 CEST 2008


Hi all,
Thinking of a syntax for 'getattr' and 'setattr' dynamic access.

'obj.prop' has an easy access, but

att= 'prop'
getattr( obj, att )

is much clumsier, while no less useful, maybe more.

What are the changes, pros and cons, involved in something like:

obj:att for a dynamic access, and obj.att for static?

Snice readability is a factor, I'm open to other markings than ':'.
'$' and '?' are available, and I note that a~b, a:b, and, a!b for
identifiers 'a' and 'b' are unambiguous.




More information about the Python-list mailing list