[Python-ideas] Assignment decorators (Re: The Descriptor Protocol...)

Cameron Simpson cs at zip.com.au
Tue Mar 8 02:10:27 CET 2011


On 04Mar2011 13:39, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
| Guido van Rossum wrote:
| 
| >Eek! All other uses of 'as' in Python have the target on the right.
| 
| Well, it doesn't necessarily have to be 'as'. It could be
| 
|   def Fred = namedtuple('x y z')
| 
| but that wouldn't give as much of a clue that something
| special is happening in the middle.
| 
| Is the reversal really all that much of a problem? It makes
| sense when you read it as an English sentence: "Define
| Fred as a named tuple." Just like all the other uses of
| "as" mean what they seem to mean.

No, just the reverse of what all the other uses of "as" mean:-(

This:

  def namedtuple('x y z') as Fred

is consistent with current uses.

It is ugly/confusing to my eye, but I really need to read this thread more
thoroughly.

| Given that each existing use of 'as' has its own unique
| quirks, forcing 'as' to always bind on the right regardless
| of anything else might be seen as a foolish consistency.

Doesn't seem foolish to me. Seems grammatically sound and highly
desirable.

Cheers,
-- 
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

Hofstadter's Law: It always takes longer than you expect, even when you take
into account Hofstadter's Law.
- Douglas Hosfstadter, Godel, Escher, Bach: an Eternal Golden Braid



More information about the Python-ideas mailing list