>     What would this mythical block statement look like that would make
> properties easier to write than the above late-binding or the subclass
> Property recipe?

I suppose something like:

class C(object):
    x = prop:
        """ Yay for property x! """
        def __get__(self):
            return self._x
        def __set__(self, value):
            self._x = x

and then:

def prop(@block):
    return property(
        fget=block.get("__get__"),
        fset=block.get("__set__"),
        fdel=block.get("__delete__"),
        doc=block.get("__doc__", ""),
    )

(where "@bargs" would be the syntax to refer to block args as a dict,
the same way "**kargs" already exist)



_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to