Alex Martelli wrote:
It's not clear to me what semantics, exactly, x.y := z would be defined
to have (assuming := is the syntax sugar for ``rebinding'').  Perhaps,
by analogy with every other augmented operator, it should be equivalent
to:

    _temp = x.y
    x.y = type(temp).__irebind__(temp, z)

This makes it crystal-clear what happens when type(x).y is a descriptor
with/without __set__ and __get__, when type(x) defines __getattribute__
or __setattr__, etc, etc.  Giving type object an __irebind__ which just
returns the second operand would complete the semantics.  Of course,
doing it this way would open the issue of types overriding __irebind__,
and it's not clear to me that this is intended, or desirable.  So, maybe
some other semantics should be the definition.  But since "rebinding" is
not a primitive, the semantics do need to be somehow defined in terms of
elementary operations of getting and setting (of attributes, items, &c).

I was thinking of something simpler:

  x.y
  x.y = z

That is, before the assignment attempt, x.y has to resolve to *something*, but the interpreter isn't particularly fussy about what that something is.

Cheers,
Nick.

--
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---------------------------------------------------------------
            http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to