On 04/04/2008, Zaur Shibzoukhov <[EMAIL PROTECTED]> wrote: > Certainly! It don't intent to replace this way of defining/modifining > properties. First, it is an example of "with" statement application. > Second, suggested approach allow to write your example in the > following way: > > class C(object): > with property as x: > def get(self): return self._x > def set(self, value): self._x = value > def del(self): del self._x > > IMHO it's quite readable too because of additional identation.
It does look reasonably nice. But I'd suggest submitting it as a recipe in the Python cookbook - it doesn't seem to me that it needs to go in the core. I'm not entirely sure about it, as I don't think "with property as x" reads right. And you shouldn't call it "property" - that name is already builtin (and it doesn't read right, see above). I can't think of a good name that *does* read right in the context of "with ... as x", either. Paul. _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com