[Python-ideas] Assignment decorators (Re: The Descriptor Protocol...)
greg.ewing at canterbury.ac.nz
Tue Mar 8 23:18:09 CET 2011
Cameron Simpson wrote:
> def namedtuple('x y z') as Fred
> is consistent with current uses.
I still think insisting that all uses of the word 'as'
bind a name on the right is a foolish consistency. To
my mind it's more important that the name being defined
appear as close to the left as possible.
This is something that Pascal got right and C got wrong.
Putting the defined name on the left makes it easier to
visually scan down the code looking for the definition
of something. It also makes it easier to write regular
expressions etc. that search for definitions.
> Seems grammatically sound and highly
But the other way is equally grammatically sound --
in fact it's even more so in this case. To my ears,
"define x as somethingorother" sounds much more
natural than "define somethingorother as x".
More information about the Python-ideas