Nick Coghlan wrote:
Nick Coghlan wrote:

Semantics
---------
The code::

<statement> with:
   <suite>

translates to::

def unique_name():
    <suite>
    <statement>
unique_name()


Bleh. Not only was my proposed grammar change wrong, my suggested semantics are wrong, too.


Raise your hand if you can see the problem with applying the above semantics to the property descriptor example.

Eh, never mind. The following works today, so the semantics I proposed are actually fine. (This is exactly the semantics proposed for the property example)


Py> class C(object):
...   def _x():
...     def get(self):
...       print "Hi!"
...     def set(self, value):
...       print "Hi again!"
...     def delete(self):
...       print "Bye"
...     return property(get, set, delete)
...   x = _x()
...
Py> C.x
<property object at 0x009E6738>
Py> C().x
Hi!
Py> C().x = 1
Hi again!
Py> del C().x
Bye

Cheers,
Nick.

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

Reply via email to