-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Apr 4, 2008, at 2:40 PM, Paul Moore wrote: > 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.
It looks nice to me. I think it's exactly right because it's entirely clear what the intent is. Very clever too, so I would be +1 on extending property to handle this. > 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. - -Barry -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (Darwin) iQCVAwUBR/Z6M3EjvBPtnXfVAQIyMgP+LPEX2EU1Pyqbnj0cASgK/iWy6j3ljdVc KNMVhwI60jiYOK1JBv8knanTjwpwburI88hbOL1nvJrmgtd8QmKkapaRihdjcFt1 Tu5k0jqH9gScilMec0Fl5aVt/YKjTgyJmxBL8EnKNV+UZ3emzbYda2fTvz6Egz5u /tU5aJTGyUU= =gVxJ -----END PGP SIGNATURE----- _______________________________________________ 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