[Python-Dev] New syntax for 'dynamic' attribute access (original) (raw)
Raymond Hettinger python at rcn.com
Mon Feb 12 10:25:54 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 ]
[Jack Jansen]
I like the functionality, but I don't like the syntax, to me it looks too much like a method call.
To me self.[methodname] = self.metadata.[methodname] looks better: what we're doing here is more like dictionary lookup than calling functions.
I also like the functionality.
Rather than munge existing syntaxes, an altogether new one would be more clear:
self->name = self.metadata->name
I like the arrow syntax because is the lookup process can be more involved than a simple dictionary lookup (perhaps traveling up to base classes). IOW, getattr(a,n) is not always the same as a.dict[n]. The a.getattribute(n) process can be more complex than that and a bracketed dictionary-like syntax would misleadingly mask the lookup process.
Raymond
- 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 ]